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.

addpkg 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #!/bin/sh
  2. AddPackages()
  3. {
  4. PKGDIR="/usr/share/siduction-scripts/packages"
  5. PKGSRC_LOCAL="/usr/share/siduction-scripts/clone"
  6. PKGSRC_REMOTE="https://git.siduction.org/extra/pyfll.git"
  7. if [ -e /etc/default/distro ]; then
  8. . /etc/default/distro
  9. fi
  10. settings_version=$(echo $FLL_WALLPAPER | cut -d / -f 5)
  11. xorg_installed=$(dpkg -l | grep Xorg)
  12. if [ -z "${xorg_installed}" ]; then
  13. dest_platform=nox
  14. else
  15. dest_platform=xorg
  16. fi
  17. case $1 in
  18. cinnamon)
  19. PACK_PROFILE=cinnamon
  20. ;;
  21. gnome)
  22. PACK_PROFILE=gnome
  23. ;;
  24. kde)
  25. PACK_PROFILE=kde
  26. ;;
  27. plasma5)
  28. PACK_PROFILE=plasma5
  29. ;;
  30. lxde)
  31. PACK_PROFILE=lxde
  32. ;;
  33. lxqt)
  34. PACK_PROFILE=lxqt
  35. ;;
  36. mate)
  37. PACK_PROFILE=mate
  38. ;;
  39. siducation-full)
  40. PACK_PROFILE=siducation-full
  41. ;;
  42. siducation-lite)
  43. PACK_PROFILE=siducation-lite
  44. ;;
  45. xfce)
  46. PACK_PROFILE=xfce
  47. ;;
  48. custom)
  49. PACK_PROFILE=custom
  50. ;;
  51. *)
  52. ;;
  53. esac
  54. if [ "$PACK_PROFILE" = "custom" ]; then
  55. if [ ! -f ${PKGDIR}/custom ] ; then
  56. echo '######################################################'
  57. echo 'WARNING custom pkglist file not found!'
  58. echo 'Please add file /usr/share/siduction-scripts/custom.'
  59. echo 'Please use as template /usr/share/siduction-scripts/custom.ex file.'
  60. echo "WARNING don't add inexistent packages names to don't get in trouble."
  61. echo 'Thank you !'
  62. echo '######################################################'
  63. exit 1
  64. else
  65. # moves custom pkg list to custom-pklist.orig and show a message about it
  66. echo '######################################################'
  67. echo "Cpying custom pkglist to custom.orig"
  68. echo "If you don't need it anymore you should remove it."
  69. echo '######################################################'
  70. awk '/^packages/,/^"""/' ${PKGDIR}/${PACK_PROFILE} | grep -v '"""' | grep -v '#' > ${PKGDIR}/${PACK_PROFILE}-pkglist
  71. cp ${PKGDIR}/$PACK_PROFILE ${PKGDIR}/${PACK_PROFILE}.orig
  72. fi
  73. else
  74. # TODO settings
  75. #case ${settings_version} in
  76. # december)
  77. # echo " siduction-settings-${PACK_PROFILE}-${settings_version}" > ${PKGDIR}/${PACK_PROFILE}-pkglist
  78. # echo " siduction-art-${PACK_PROFILE}-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  79. # ;;
  80. # indiansummer)
  81. # echo " siduction-settings-${PACK_PROFILE}-${settings_version}" > ${PKGDIR}/${PACK_PROFILE}-pkglist
  82. # echo " siduction-art-${PACK_PROFILE}-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  83. # echo " siduction-art-wallpaper-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  84. # ;;
  85. # paintitblack)
  86. # echo " siduction-settings-${PACK_PROFILE}-paintitblack" > ${PKGDIR}/${PACK_PROFILE}-pkglist
  87. # echo " siduction-art-${PACK_PROFILE}-paintitblack" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  88. # echo " siduction-art-wallpaper-paintitblack" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  89. # ;;
  90. # *)
  91. # echo " There aren't supported settings for ${PACK_PROFILE} until now"
  92. # ;;
  93. #esac
  94. # clone pyfll git and get requested PACK_PROFILE or show a message for custom pkg list
  95. echo "\nCloning pyfll."
  96. git clone "${PKGSRC_REMOTE}" "${PKGSRC_LOCAL}"
  97. sleep 2
  98. echo "\nFetching siduction ${PACK_PROFILE} profile list."
  99. cp "${PKGSRC_LOCAL}/pyfll/packages/${PACK_PROFILE}" "${PKGDIR}/${PACK_PROFILE}"
  100. # Reads packages from packages profile
  101. awk '/^packages/,/^"""/' ${PKGDIR}/${PACK_PROFILE} | grep -v '"""' | grep -v '#' >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  102. # Search main file package for include dependecies
  103. # and build an depends file ( depends )
  104. awk '/^deps/,/^"""/' ${PKGDIR}/${PACK_PROFILE} | grep -v '"""' | grep -v '#' > ${PKGDIR}/${PACK_PROFILE}-deps
  105. # Search if we have NOX or XORG
  106. case ${dest_platform} in
  107. xorg)
  108. cat ${PKGDIR}/${PACK_PROFILE}-deps | grep -v 200 | grep -v 100 | grep -v 300 |grep -v 500 > ${PKGDIR}/${PACK_PROFILE}-depends
  109. ;;
  110. nox)
  111. cat ${PKGDIR}/${PACK_PROFILE}-deps | grep -v 200 | grep -v 100 | grep -v 300 | grep -v live | grep -v fll | grep -v installer > ${PKGDIR}/${PACK_PROFILE}-depends
  112. echo " siduction-settings-lightdm-gtk-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  113. ;;
  114. *)
  115. echo "You can use addpkg only over on installed NOX or XORG siduction."
  116. ;;
  117. esac
  118. while read pkgdepends ; do
  119. echo "Fetching for ${PACK_PROFILE} profile $pkgdepends depend."
  120. cp "${PKGSRC_LOCAL}/pyfll/packages/packages.d/$pkgdepends" "${PKGDIR}/$pkgdepends-depfiles"
  121. done < ${PKGDIR}/${PACK_PROFILE}-depends
  122. for i in ${PKGDIR}/*-depfiles; do
  123. awk '/^packages/,/^"""/' ${i} | grep -v '"""' | grep -v '#' >> ${PKGDIR}/${PACK_PROFILE}-pkglist
  124. done
  125. # Removes temporary files
  126. if [ -f ${PKGDIR}/${PACK_PROFILE}-pkglist ] ; then
  127. rm -f ${PKGDIR}/*-dep*
  128. rm -f ${PKGDIR}/${PACK_PROFILE}
  129. fi
  130. fi
  131. # install files
  132. apt-get install $(cat ${PKGDIR}/${PACK_PROFILE}-pkglist)
  133. # purge meta files
  134. # originally a hard-coded list: siduction-meta-xorg siduction-meta-xsiduction siduction-meta-xdebian siduction-meta-mediabase
  135. purgelist="$(dpkg -l | awk '/siduction-meta/ {print $2}')"
  136. if [ -z "${purgelist}" ] ; then
  137. printf "%s\n" "Nothing to purge!"
  138. else
  139. printf "%s\n" "Now purging meta packages: ${purgelist}"
  140. apt-get purge --assume-yes "${purgelist}"
  141. fi
  142. # removes built package list and pyfll git clone
  143. rm -f /usr/share/siduction-scripts/packages/${PACK_PROFILE}-pkglist
  144. rm -Rf "${PKGSRC_LOCAL}"
  145. # Settings message
  146. if [ "$PACK_PROFILE" = "custom" ]; then
  147. echo "You should customize your's new added flavour."
  148. else
  149. echo "\nYour installed settings for existing flavours are ${settings_version}."
  150. echo "Please add your desired settings for ${PACK_PROFILE} if exists in siduction repos. \n"
  151. echo "Otherwise you can try siduction-settings-${PACK_PROFILE}-paintitblack
  152. siduction-art-${PACK_PROFILE}-paintitblack and siduction-art-wallpaper-paintitblack. \n"
  153. sleep 2
  154. fi
  155. }
  156. case "$1" in
  157. cinnamon|custom|gnome|kde|plasma5|lxde|lxqt|mate|siducation-full|siducation-lite|xfce)
  158. AddPackages $1
  159. ;;
  160. *)
  161. echo "Usage: addpkg {cinnamon|custom|gnome|kde|plasma5|lxde|lxqt|mate|rqt|siducation-full|siducation-lite|xfce}"
  162. exit 1
  163. ;;
  164. esac