installer 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #!/bin/bash
  2. #
  3. # Uruk Updater
  4. #
  5. # Copyright 2022 hayder majid <hayder@riseup.net>
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, you can download it from here:
  19. # https://www.gnu.org/licenses/gpl-3.0.html
  20. #
  21. #Check if you run this script with root privileges
  22. if [ "$(whoami)" != "root" ]; then
  23. echo "You need to be in root privileges to run this script. Exiting."
  24. exit 1
  25. fi
  26. #set the working dir
  27. WORKDIR=$(pwd)
  28. #main installer function
  29. install(){
  30. echo "Installing Dependencies"
  31. apt install gir1.2-ayatanaappindicator3-0.1 libayatana-appindicator3-1 gir1.2-gtk-3.0 zenity python3-gi python3-tk synaptic libnotify-bin
  32. if [ ! -d "/usr/lib/urukUpdater" ]; then
  33. mkdir /usr/lib/urukUpdater;
  34. cp ${WORKDIR}/usr/lib/urukUpdater/* /usr/lib/urukUpdater;
  35. else
  36. rm -rf /usr/lib/urukUpdater/*
  37. cp ${WORKDIR}/usr/lib/urukUpdater/* /usr/lib/urukUpdater;
  38. fi
  39. if [ ! -d "/usr/share/urukUpdater" ]; then
  40. mkdir /usr/share/urukUpdater;
  41. cp -r ${WORKDIR}/usr/share/urukUpdater/* /usr/share/urukUpdater;
  42. else
  43. rm -rf /usr/share/urukUpdater/*;
  44. cp -r ${WORKDIR}/usr/share/urukUpdater/* /usr/share/urukUpdater;
  45. fi
  46. if [ ! -f "/usr/share/applications/urukupdater.desktop" ]; then
  47. cp ${WORKDIR}/urukupdater.desktop /usr/share/applications;
  48. else
  49. cp --force ${WORKDIR}/urukupdater.desktop /usr/share/applications;
  50. fi
  51. if [ ! -f "/usr/share/pixmaps/urukupdater.svg" ]; then
  52. cp ${WORKDIR}//usr/share/pixmaps/urukupdater.svg /usr/share/pixmaps/;
  53. else
  54. cp --force ${WORKDIR}//usr/share/pixmaps/urukupdater.svg /usr/share/pixmaps/;
  55. fi
  56. if [ ! -f "/usr/bin/urukupdater" ]; then
  57. cp ${WORKDIR}/usr/bin/urukupdater /usr/bin/;
  58. else
  59. cp --force ${WORKDIR}/usr/bin/urukupdater /usr/bin/;
  60. fi
  61. if [ ! -f "/etc/sudoers.d/urukupdater" ]; then
  62. cp ${WORKDIR}/etc/sudoers.d/urukupdater /etc/sudoers.d/;
  63. else
  64. cp --force ${WORKDIR}/etc/sudoers.d/urukupdater /etc/sudoers.d/;
  65. fi
  66. if [ ! -f "/etc/xdg/autostart/urukupdater.desktop" ]; then
  67. cp ${WORKDIR}/etc/xdg/autostart/urukupdater.desktop /etc/xdg/autostart;
  68. else
  69. cp --force ${WORKDIR}/etc/xdg/autostart/urukupdater.desktop /etc/xdg/autostart;
  70. fi
  71. chmod +x /usr/bin/urukupdater
  72. chmod +x /usr/share/urukUpdater/*.py
  73. chmod +x /usr/share/urukUpdater/updater-status
  74. chmod +x /usr/lib/urukUpdater/*
  75. chmod +x /etc/sudoers.d/urukupdater
  76. }
  77. #uninstaller function
  78. uninstall(){
  79. if [ -d "/usr/lib/urukUpdater" ]; then
  80. rm -rf /usr/lib/urukUpdater;
  81. fi
  82. if [ -d "/usr/share/urukUpdater" ]; then
  83. rm -rf /usr/share/urukUpdater;
  84. fi
  85. if [ -f "/usr/share/applications/urukupdater.desktop" ]; then
  86. rm -rf /usr/share/applications/urukupdater.desktop;
  87. fi
  88. if [ -f "/usr/share/pixmaps/urukupdater.svg" ]; then
  89. rm -rf /usr/share/pixmaps/urukupdater.svg;
  90. fi
  91. if [ -f "/usr/bin/urukupdater" ]; then
  92. rm -rf /usr/bin/urukupdater;
  93. fi
  94. if [ -f "/etc/sudoers.d/urukupdater" ]; then
  95. rm -rf /etc/sudoers.d/urukupdater;
  96. fi
  97. if [ -f "/etc/xdg/autostart/urukupdater.desktop" ]; then
  98. rm -rf /etc/xdg/autostart/urukupdater.desktop;
  99. fi
  100. }
  101. #translate(){
  102. #}
  103. if [ "$1" = "help" ]; then
  104. echo " This script will help you to install or uninstall for Uruk Updater"
  105. echo " "
  106. echo " Usage this script as follows:"
  107. echo " "
  108. #echo " sudo ./installer help|install|uninstall|translate"
  109. echo " sudo ./installer help|install|uninstall"
  110. echo " "
  111. echo " "
  112. echo " Examples:"
  113. echo " "
  114. echo " "
  115. echo " sudo ./installer install ==> (to install urukupdater on your system)"
  116. echo " "
  117. echo " sudo ./installer uninstall ==> (to remove uninstall urukupdater from your system)"
  118. #echo " "
  119. #echo " sudo ./installer translate ==> (to generate translation files)"
  120. echo " "
  121. echo " sudo ./installer help ==> (to show this help instructions )"
  122. echo " "
  123. echo " for more information, you can see to official page:"
  124. echo " https://www.notabug.org/hayderctee/urukupdater"
  125. echo " "
  126. elif [ "$1" = "" ]; then
  127. echo " you need to use one argument to use this script"
  128. echo " "
  129. echo " Usage of installer script is as follows:"
  130. echo " "
  131. echo " sudo ./installer install ==> (to install urukupdater on your system)"
  132. echo " "
  133. echo " sudo ./installer uninstall ==> (to remove uninstall urukupdater from your system)"
  134. echo " "
  135. #echo " sudo ./installer translate ==> (to generate translation files)"
  136. echo " "
  137. echo " sudo ./installer help ===> for more info"
  138. elif [ "$1" = "install" ]; then
  139. echo "installing Uruk Updater . . ."
  140. install
  141. echo "done"
  142. elif [ "$1" = "uninstall" ]; then
  143. echo "uninstalling Uruk Updater . . ."
  144. echo ""
  145. uninstall
  146. echo "done"
  147. #elif [ "$1" = "translate" ]; then
  148. #echo "generating translate files . . ."
  149. #echo ""
  150. #translate
  151. else
  152. echo "Use valid input command . . ."
  153. echo " you need to use one argument to use this script"
  154. echo " "
  155. echo " Usage of installer script is as follows:"
  156. echo " "
  157. echo " sudo ./installer install ==> (to install urukupdater on your system)"
  158. echo " "
  159. echo " sudo ./installer uninstall ==> (to remove uninstall urukupdater from your system)"
  160. echo " "
  161. #echo " sudo ./installer translate ==> (to generate translation files)"
  162. echo " "
  163. echo " sudo ./installer help ===> for more info"
  164. fi