updater-status 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/bash
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Uruk Update Manager
  5. #
  6. # Copyright 2022 hayder majid <hayder@riseup.net>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. # MA 02110-1301, USA.
  22. #result=$(ps aux | grep -i "/usr/bin/uruk-refresh-cache" | grep -v "grep" | wc -l)
  23. #if [ $result -ge 1 ]
  24. #then
  25. #killall /usr/bin/uruk-refresh-cache
  26. #else
  27. #/usr/bin/uruk-refresh-cache Err:
  28. #fi
  29. NUM=0
  30. NUMUPGRADE=${NUM}
  31. UPGRADEMODE="--upgrade-mode"
  32. #MESS1=$(echo -e "Your System is up to date!"; echo)
  33. TITL=$(echo -e "System Updating Info"; echo);
  34. TITL1=$(echo -e "Checking for updates"; echo);
  35. TEXT1=$(echo -e "Checking your System for updates \n this may take a few minutes depending on your speed connection"; echo);
  36. UPGM=$(echo -e "Upgrade System"; echo);
  37. UPGL=$(echo -e "View packages"; echo);
  38. OKL=$(echo -e "Ok"; echo);
  39. CANL=$(echo -e "Cancel"; echo)
  40. ERR=$(echo -e "Opps! Something went wrong\!, \n please try again later"; echo)
  41. MESS2=$(echo -e "You have $NUMUPGRADE packages needed to be upgrade\! \n \n if you want to continue press \" $UPGM \" \n to continue, or \" $UPGL \" to show upgraded list packages , or \" $CANL \" to exit this window"; echo)
  42. UPG(){
  43. ANS=$(zenity --info --title="$TITL" --text="$MESS2" --ok-label="$CANL" --extra-button="$UPGM" --extra-button="$UPGL" --width=400 --height=200 --window-icon=/usr/share/pixmaps/urukupdater.svg)
  44. RES=$?
  45. VAR="${RES}-${ANS}"
  46. if [ "$VAR" = "0-" ]; then
  47. exit 0;
  48. elif [ "$VAR" = "1-$UPGM" ]; then
  49. pkexec /usr/sbin/synaptic --hide-main-window $UPGRADEMODE --non-interactive --parent-window-id %d;
  50. else
  51. zenity --text-info --title="Updateing list" --ok-label="$UPGM" --filename=/usr/share/urukUpdater/status/upd.list --window-icon=/usr/share/pixmaps/urukupdater.svg;
  52. rc=$?
  53. case $rc in
  54. 0)
  55. pkexec /usr/sbin/synaptic --hide-main-window $UPGRADEMODE --non-interactive --parent-window-id %d;
  56. ;;
  57. 1)
  58. exit 0
  59. ;;
  60. -1)
  61. zenity --error --text="$ERR " --width=200 --height=130 --window-icon=/usr/share/pixmaps/urukupdater.svg
  62. ;;
  63. esac
  64. fi
  65. }
  66. UPD(){
  67. if [ "$NUMUPGRADE" != 0 ] ; then
  68. UPG
  69. sudo /usr/lib/urukUpdater/checker
  70. sudo /usr/lib/urukUpdater/setter
  71. sudo /usr/lib/urukUpdater/restart
  72. elif [ "$NUMUPGRADE" = 0 ] ; then
  73. sudo /usr/lib/urukUpdater/checker
  74. sudo /usr/lib/urukUpdater/setter
  75. sudo /usr/lib/urukUpdater/restart
  76. fi
  77. }
  78. if grep -q "Err:" "/usr/share/urukUpdater/status/err" || grep -q "E:" "/usr/share/urukUpdater/status/err" || grep -q "Err:" "/usr/share/urukUpdater/status/result"; then
  79. zenity --error --text="$ERR " --width=200 --height=130 --window-icon=/usr/share/pixmaps/urukupdater.svg
  80. else
  81. UPD
  82. fi
  83. exit 0