aiaFunc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #!/bin/bash
  2. #
  3. # AIA
  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. install(){
  29. if [ ! -d "/usr/lib/AIA" ]; then
  30. mkdir /usr/lib/AIA;
  31. cp ${WORKDIR}/{*.py,orca-autostart.desktop} /usr/lib/AIA;
  32. else
  33. rm -rf /usr/lib/AIA/*
  34. cp ${WORKDIR}/{*.py,orca-autostart.desktop} /usr/lib/AIA;
  35. fi
  36. if [ ! -d "/usr/share/AIA" ]; then
  37. mkdir /usr/share/AIA;
  38. cp -r ${WORKDIR}/translate/locale /usr/share/AIA;
  39. else
  40. rm -rf /usr/share/AIA/locale/*;
  41. cp ${WORKDIR}/translate/locale/* /usr/share/AIA/locale;
  42. fi
  43. if [ ! -f "/usr/share/applications/aia.desktop" ]; then
  44. cp ${WORKDIR}/aia.desktop /usr/share/applications;
  45. else
  46. cp --force ${WORKDIR}/aia.desktop /usr/share/applications;
  47. fi
  48. if [ ! -f "/usr/bin/AIA" ]; then
  49. cp ${WORKDIR}/AIA /usr/bin/;
  50. else
  51. cp --force ${WORKDIR}/AIA /usr/bin/;
  52. fi
  53. if [ ! -f "/usr/bin/usudo" ]; then
  54. cp ${WORKDIR}/usudo /usr/bin/;
  55. else
  56. cp --force ${WORKDIR}/usudo /usr/bin/;
  57. fi
  58. chmod +x /usr/bin/{AIA,usudo}
  59. }
  60. uninstall(){
  61. if [ -d "/usr/lib/AIA" ]; then
  62. rm -rf /usr/lib/AIA;
  63. fi
  64. if [ -d "/usr/share/AIA" ]; then
  65. rm -rf /usr/share/AIA;
  66. fi
  67. if [ -f "/usr/share/applications/aia.desktop" ]; then
  68. rm -rf /usr/share/applications/aia.desktop;
  69. fi
  70. if [ -f "/usr/bin/AIA" ]; then
  71. rm -rf /usr/bin/AIA;
  72. fi
  73. }
  74. #translate(){
  75. #}
  76. if [ "$1" = "help" ]; then
  77. echo " This script will help you to install, uninstall or make translate for AIA"
  78. echo " "
  79. echo " Usage this script as follows:"
  80. echo " "
  81. #echo " sudo ./aiaFunc help|install|uninstall|translate"
  82. echo " sudo ./aiaFunc help|install|uninstall"
  83. echo " "
  84. echo " "
  85. echo " Examples:"
  86. echo " "
  87. echo " "
  88. echo " sudo ./aiaFunc install ==> (to install AIA on your system)"
  89. echo " "
  90. echo " sudo ./aiaFunc uninstall ==> (to remove uninstall AIA from your system)"
  91. #echo " "
  92. #echo " sudo ./aiaFunc translate ==> (to generate translation files)"
  93. echo " "
  94. echo " sudo ./aiaFunc help ==> (to show this help instructions )"
  95. echo " "
  96. echo " for more information, you can see to official page:"
  97. echo " https://www.notabug.org/hayderctee/AIA"
  98. echo " "
  99. elif [ "$1" = "" ]; then
  100. echo " you need to use one argument to use this script"
  101. echo " "
  102. echo " Usage of aiaFunc is as follows:"
  103. echo " "
  104. echo " sudo ./aiaFunc install ==> (to install AIA on your system)"
  105. echo " "
  106. echo " sudo ./aiaFunc uninstall ==> (to remove uninstall AIA from your system)"
  107. echo " "
  108. #echo " sudo ./aiaFunc translate ==> (to generate translation files)"
  109. echo " "
  110. echo " sudo ./aiaFunc help ===> for more info"
  111. elif [ "$1" = "install" ]; then
  112. echo "installing AIA . . ."
  113. install
  114. echo "done"
  115. elif [ "$1" = "uninstall" ]; then
  116. echo "uninstalling AIA . . ."
  117. echo ""
  118. uninstall
  119. echo "done"
  120. #elif [ "$1" = "translate" ]; then
  121. #echo "generating translate files . . ."
  122. #echo ""
  123. #translate
  124. fi