A gui application used for interactive upgrade reminders on Debian. I no longer use it and will not push changes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
1.0 KiB

  1. #!/bin/bash
  2. distResult=$(grep "PRETTY_NAME=" < /etc/*-release)
  3. echo "$distResult"
  4. updateInterval="$1"
  5. updatePath="$(pwd)/update.py"
  6. if [ -z "$updateInterval" ]; then
  7. updateInterval=30
  8. echo $updateInterval
  9. fi
  10. #Check that the running distro is debian and update.py exists
  11. if [[ "$distResult" != *"Debian"* ]]; then
  12. echo 'Identified distribution is not debian. Quiting...'
  13. exit 1
  14. fi
  15. if [ ! -f "$updatePath" ]; then
  16. echo 'update.py not found. Quitting...'
  17. exit 1
  18. fi
  19. #Check if there is too many arguments
  20. if [ "$#" -gt "1" ]; then
  21. echo "Too many arguments. There are $#."
  22. exit 1
  23. fi
  24. retes='^[0-9]+$'
  25. if ! [[ $updateInterval =~ $retes ]]; then
  26. echo 'interval has non int value. Quiting.'
  27. exit 1
  28. fi
  29. echo 'Starting'
  30. #inTime = '17 * * * * root cd / && run-parts --report /etc/cron.hourly'
  31. insert="$updateInterval 5 pkg.updates $updatePath"
  32. currentLine=$(cat /etc/anacrontab | grep 'pkg.updates')
  33. if [ "$currentLine" = "" ]; then
  34. echo "$insert" >> /etc/anacrontab
  35. else
  36. sed -i "/pkg.updates/ c\\$insert" /etc/anacrontab
  37. fi