├── .github └── FUNDING.yml ├── packages ├── un-get-2022.08.22.txz.md5 ├── un-get-2022.08.23.txz.md5 ├── un-get-2022.08.23a.txz.md5 ├── un-get-2022.08.23b.txz.md5 ├── un-get-2022.08.23c.txz.md5 ├── un-get-2022.08.24.txz.md5 ├── un-get-2022.08.22.txz ├── un-get-2022.08.23.txz ├── un-get-2022.08.23a.txz ├── un-get-2022.08.23b.txz ├── un-get-2022.08.23c.txz └── un-get-2022.08.24.txz ├── source ├── usr │ └── local │ │ └── emhttp │ │ └── plugins │ │ └── un-get │ │ ├── images │ │ └── un-get.png │ │ ├── changelog │ │ └── un-get └── makepkg.sh ├── LICENSE ├── README.md └── un-get.plg /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: ich777 -------------------------------------------------------------------------------- /packages/un-get-2022.08.22.txz.md5: -------------------------------------------------------------------------------- 1 | 25a2916a278b05fe0f66ba6374f30f0d 2 | -------------------------------------------------------------------------------- /packages/un-get-2022.08.23.txz.md5: -------------------------------------------------------------------------------- 1 | 194ac8dedc92d453a7474e0aa09e96d2 2 | -------------------------------------------------------------------------------- /packages/un-get-2022.08.23a.txz.md5: -------------------------------------------------------------------------------- 1 | 0b115c390ef5d066d8ae701c6000e5f8 2 | -------------------------------------------------------------------------------- /packages/un-get-2022.08.23b.txz.md5: -------------------------------------------------------------------------------- 1 | 16f5294cab4d845856ae3fa703dc9cbd 2 | -------------------------------------------------------------------------------- /packages/un-get-2022.08.23c.txz.md5: -------------------------------------------------------------------------------- 1 | dc302c4c0bf3ae9ac78e9c89c7494cbb 2 | -------------------------------------------------------------------------------- /packages/un-get-2022.08.24.txz.md5: -------------------------------------------------------------------------------- 1 | cecfe4e723bc273bb160d29f2f47a492 2 | -------------------------------------------------------------------------------- /packages/un-get-2022.08.22.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/packages/un-get-2022.08.22.txz -------------------------------------------------------------------------------- /packages/un-get-2022.08.23.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/packages/un-get-2022.08.23.txz -------------------------------------------------------------------------------- /packages/un-get-2022.08.23a.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/packages/un-get-2022.08.23a.txz -------------------------------------------------------------------------------- /packages/un-get-2022.08.23b.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/packages/un-get-2022.08.23b.txz -------------------------------------------------------------------------------- /packages/un-get-2022.08.23c.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/packages/un-get-2022.08.23c.txz -------------------------------------------------------------------------------- /packages/un-get-2022.08.24.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/packages/un-get-2022.08.24.txz -------------------------------------------------------------------------------- /source/usr/local/emhttp/plugins/un-get/images/un-get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ich777/un-get/HEAD/source/usr/local/emhttp/plugins/un-get/images/un-get.png -------------------------------------------------------------------------------- /source/makepkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PLUGIN_NAME="un-get" 3 | BASE_DIR="/usr/local/emhttp/plugins" 4 | TMP_DIR="/tmp/${PLUGIN_NAME}_"$(echo $RANDOM)"" 5 | VERSION="$(date +'%Y.%m.%d')" 6 | mkdir -p $TMP_DIR/$VERSION 7 | cd $TMP_DIR/$VERSION 8 | cp --parents -R $BASE_DIR/$PLUGIN_NAME/ $TMP_DIR/$VERSION/ 9 | chmod -R 755 $TMP_DIR/$VERSION/ 10 | rm $TMP_DIR/$VERSION/$BASE_DIR/$PLUGIN_NAME/README.md 11 | makepkg -l y -c y $TMP_DIR/${PLUGIN_NAME}-$VERSION.txz 12 | md5sum $TMP_DIR/${PLUGIN_NAME}-$VERSION.txz | awk '{print $1}' > $TMP_DIR/${PLUGIN_NAME}-$VERSION.txz.md5 13 | rm -R $TMP_DIR/$VERSION/ 14 | chmod 755 $TMP_DIR/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Christoph Hummer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # un-get for unRAID 2 | 3 | un-get is a simple command line tool to install packages from Slackware to unRAID. 4 | 5 | Start by issuing: `un-get --help` in a unRAID Terminal to get available commands and how to use this tool. 6 | 7 | **Please Note:** un-get allows only installation of packages which are not already installed on your system and only allows removing packages which are installed by un-get! 8 | 9 | **Other Repositories:** You can also add other repositories which follow the Slackware standard, even if it's hosted on GitHub like: https://github.com/ich777/slackware 10 | To do this modify `/boot/config/plugins/un-get/sources.list` and add an URL per line. 11 | 12 | **REPORTING BUGS/ISSUES:** 13 | If you find a bug or have some kind of issue with un-get please use the issue tracker here on GitHub. 14 | 15 | **DISCLAIMER** 16 | - This tool will maybe never make it to the CA App because it is meant for advanced users only 17 | - Use this only if you really, really, really need some additional package on unRAID 18 | (I would always recommend that you use Docker containers, LXC containers or VMs instead of running it on bare metal) 19 | - This tool is currently in development but should get the job just done fine -------------------------------------------------------------------------------- /source/usr/local/emhttp/plugins/un-get/changelog: -------------------------------------------------------------------------------- 1 | Version: 0.01 2 | Date: 2022-08-20 3 | 4 | - Initial release from pkg-get 5 | 6 | ---------------------------------------- 7 | 8 | Version: 0.02 9 | Date: 2022-08-22 10 | 11 | - Changed name from pkg-get to un-get - because well unRAID needs un-get 12 | - Changed from Slackware 15 to Current 13 | - Created sources.list file to support multiple repositories 14 | - Added Conraid's repository to sources.list by default 15 | - Changed installation directory to /boot/extra 16 | - Redone download, installation and remove functions 17 | - Added 'installed' option, to list installed packages by un-get 18 | - Added 'changelog' option 19 | - Changed search to show both installed and non installed packages which 20 | are available in repositories 21 | 22 | ---------------------------------------- 23 | 24 | Version: 0.03 25 | Date: 2022-08-22 26 | 27 | - Added 'upgrade' function 28 | - Speed up search by a bit 29 | - Clarified remove message when no packages were found 30 | - Fixed bug where packages won't be removed after calling 'remove' function 31 | - Fixed bug where error was displayed if installedpackages_list file where 32 | not in place 33 | 34 | ---------------------------------------- 35 | 36 | Version: 0.04 37 | Date: 2022-08-23 38 | 39 | - search function - made it more clear if packages are already installed 40 | that they not qualify for reinstallation through un-get 41 | - install function - throw a real error if package is found which is 42 | not qualifying for reinstallation through un-get 43 | - upgrade function - added message when all packages are up-to-date 44 | 45 | ---------------------------------------- 46 | 47 | Version: 0.05 48 | Date: 2022-08-23 49 | 50 | - upgrade function - fixed upgrade message issue 51 | 52 | ---------------------------------------- 53 | 54 | Version: 0.06 55 | Date: 2022-08-23 56 | 57 | - upgrade function - fixed bug in upgrade package detection 58 | 59 | ---------------------------------------- 60 | 61 | Version: 0.07 62 | Date: 2022-08-23 63 | 64 | - changed repo to Slackware 15.0 65 | - remove old package lists from repositories which are not found 66 | in sources.list 67 | 68 | ---------------------------------------- 69 | 70 | Version: 0.08 71 | Date: 2022-08-24 72 | 73 | - fixed bug so that un-get pulls always the latest package 74 | regardless from which repository 75 | 76 | ---------------------------------------- 77 | 78 | Version: 0.09 79 | Date: 2022-08-25a 80 | 81 | - remove duplicate entries for packages which are not qualifying 82 | for installation 83 | 84 | ---------------------------------------- 85 | 86 | Version: 0.10 87 | Date: 2022-08-25b 88 | 89 | - fixed bug in search where some packages were marked as not 90 | qualifying for installation 91 | 92 | ---------------------------------------- 93 | 94 | Version: 0.11 95 | Date: 2022-08-26 96 | 97 | - added cleanup function 98 | 99 | ---------------------------------------- 100 | 101 | Version: 0.12 102 | Date: 2022-08-27 103 | 104 | - fixed bug where on installation some packages would download the 105 | the wrong file 106 | 107 | ---------------------------------------- 108 | 109 | Version: 0.13 110 | Date: 2022-08-27 111 | 112 | - fixed bug in upgrade routine 113 | 114 | ---------------------------------------- 115 | 116 | Version: 0.14 117 | Date: 2022-09-25 118 | 119 | - fixed bug where some packages would not install properly 120 | - fixed bug where some packages are not found properly 121 | ---------------------------------------- 122 | 123 | Version: 0.15 124 | Date: 2022-09-26 125 | 126 | - fixed bug where some packages would not download/install properly 127 | 128 | ---------------------------------------- 129 | 130 | Version: 0.16 131 | Date: 2022-10-02 132 | 133 | - fixed bug in update routine where some packages won't update properly 134 | 135 | ---------------------------------------- 136 | 137 | Version: 0.17 138 | Date: 2022-10-12 139 | 140 | - fixed bug in checksum routine where some packages won't install 141 | 142 | ---------------------------------------- 143 | 144 | Version: 0.18 145 | Date: 2022-10-27 146 | 147 | - fixed a few typos 148 | - fix for search/install routine when package list doesn't follow the 149 | Slackware standard 150 | - minor changes and cleanup to search/install/upgrade routine 151 | 152 | ---------------------------------------- 153 | 154 | Version: 0.19 155 | Date: 2022-11-10 156 | 157 | - fixed bug in install routine if package is found in multiple sources 158 | where the correct version is downloaded but installation fails 159 | - fixed bug in install routine which doesn't always install latest version 160 | if package is available in multiple sources 161 | - fixed bug in upgrade routine which doesn't always install latest version 162 | if package is available in multiple source 163 | 164 | ---------------------------------------- 165 | 166 | Version: 0.20 167 | Date: 2022-11-13 168 | 169 | - fixed bug in update routine for commented and empty lines 170 | 171 | ---------------------------------------- 172 | 173 | Version: 0.21 174 | Date: 2023-02-02 175 | 176 | - fixed bug for repositories with .sha256 files 177 | 178 | ---------------------------------------- 179 | 180 | Version: 0.22 181 | Date: 2023-03-17 182 | 183 | - fixed bug where packages are not installing correctly if line 184 | is commented in sources.list 185 | 186 | ---------------------------------------- 187 | 188 | Version: 0.23 189 | Date: 2023-03-26 190 | 191 | - another bugfix for commented line(s) in sources.list 192 | ---------------------------------------- 193 | 194 | Version: 0.24 195 | Date: 2023-07-19 196 | 197 | - added '--force'/'-f' option to 'upgrade' to force an update from packages 198 | The option 'un-get upgrade --force' will pull all existing packages again 199 | but don't install them in case you change from Slackware 15.0 to current 200 | or vice versa. The new packages will be installed on reboot. 201 | ATTENTION: If packages are not found in the new repositories they will be 202 | uninstalled immediately after confirming the force upgrade. 203 | - fixed bug in remove_package routine 204 | 205 | ---------------------------------------- 206 | Version: 0.25 207 | Date: 2023-11-12 208 | 209 | - Corrections for spelling & grammatical errors in user-visible statements 210 | ---------------------------------------- 211 | 212 | ---------------------------------------- 213 | Version: 0.26 214 | Date: 2024-04-09 215 | 216 | - Fixed bug where some packages won't install properly if multiple are found 217 | in repositories 218 | - Move changelog into separate file 219 | - Read version from changelog 220 | ---------------------------------------- 221 | 222 | ---------------------------------------- 223 | Version: 0.27 224 | Date: 2024-11-01 225 | 226 | - Merge PR from cloudiful to fix some packages may be skipped on installation 227 | and install wrong package instead 228 | ---------------------------------------- 229 | 230 | ---------------------------------------- 231 | Version: 0.28 232 | Date: 2024-11-22 233 | 234 | - Merge PR from adapowers 235 | cleanup(): Multiple match resilience 236 | ---------------------------------------- 237 | -------------------------------------------------------------------------------- /un-get.plg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ]> 12 | 13 | 14 | 15 | 16 | 17 | ###2024.11.22 18 | - Merge PR from adapowers 'cleanup(): Multiple match resilience' 19 | 20 | ###2024.11.01 21 | - Merge PR from cloudiful to fix some packages may be skipped on installation and install wrong package instead 22 | 23 | ###2024.07.21 24 | - Change default repo from 15.0 to current for new installations. This is necessary for 7.0.0-beta.1+. If you are on 7.0.0-beta.1+ change your sources list from 15.0 to current 25 | 26 | ###2024.04.09 27 | - Fixed bug where some packages won't install properly if multiple are found in repositories 28 | - Move changelog into separate file 29 | - Read version from changelog 30 | 31 | 32 | ###2024.01.04 33 | - Make sure that repository conraid points to new URL in sources.list 34 | 35 | ###2023.11.12 36 | - Corrections for spelling and grammatical errors in user-visible statements - thank you GitHub user kcpants 37 | 38 | ###2023.07.19 39 | - added '--force'/'-f' option to 'upgrade' to force a update from packages. The option 'un-get upgrade --force' will pull all existing packages again but don't install them in case you change from Slackware 15.0 to current or vice versa. 40 | The new packages will be installed on reboot. ATTENTION: If packages are not found in the new repositories they will be uninstalled immediately after confirming the force upgrade. 41 | - fixed bug in remove_package routine 42 | 43 | ###2023.03.26 44 | - another bugfix for commented line(s) in sources.list 45 | 46 | ###2023.03.17 47 | - fixed bug where packages are not installing correctly if line is commented in sources.list 48 | 49 | ###2023.02.02 50 | - fixed bug for repositories with .sha256 files 51 | 52 | ###2022.11.13 53 | - fixed bug in update routine for commented and empty lines 54 | 55 | ###2022.11.10 56 | - fixed bug in install routine if package is found in multiple sources where the correct version is downloaded but installation fails 57 | - fixed bug in install routine which doesn't always install latest version if package is available in multiple sources 58 | - fixed bug in upgrade routine which doesn't always install latest version if package is available in multiple source 59 | 60 | 61 | ###2022.10.27 62 | - fixed a few typos 63 | - fix for search/install routine when package list doesn't follow the Slackware standard 64 | - minor changes and cleanup to search/install/upgrade routine 65 | 66 | ###2022.10.12 67 | - fixed bug in checksum routine where some packages won't install 68 | 69 | ###2022.10.02 70 | - fixed bug in update routine where some packages won't update properly 71 | - added support link - GitHub 72 | 73 | ###2022.09.26 74 | - fixed bug where some packages would not download/install properly 75 | 76 | ###2022.09.25 77 | - fixed bug where some packages would not install properly 78 | - fixed bug where some packages are not found properly 79 | 80 | ###2022.08.27a 81 | - fixed bug in upgrade routine 82 | 83 | ###2022.08.27 84 | - fixed bug where on installation some packages would download the wrong file 85 | 86 | ###2022.08.26 87 | - added cleanup function 88 | 89 | ###2022.08.25b 90 | - fixed bug in search where some packages where marked as not qualifying for installation 91 | 92 | ###2022.08.25a 93 | - remove duplicate entries for packages which are not qualifying for installation 94 | 95 | ###2022.08.25 96 | - switched over to GitHub Release for plugin packages 97 | 98 | ###2022.08.24 99 | - fixed bug so that un-get pulls always the latest package regardless from which repository 100 | 101 | ###2022.08.23c 102 | - changed repo to Slackware 15.0 103 | - remove old package lists from repositories which are not found in sources.list 104 | 105 | ###2022.08.23b 106 | - upgrade function - fixed bug in upgrade package detection 107 | 108 | ###2022.08.23a 109 | - upgrade function - fixed upgrade message issue 110 | - changed icon 111 | - added check if installedpackages_list exist 112 | 113 | ###2022.08.23 114 | - search function - made it more clear if packages are already installed that they not qualify for reinstallation through un-get 115 | - install function - throw a real error if package is found which is not qualifying for reinstallation through un-get 116 | - upgrade function - added message when all packages are up-to-date 117 | 118 | ###2022.08.22 119 | - Changed name from pkg-get to un-get - because well unRAID needs un-get 120 | - Changed from Slackware 15 to Current 121 | - Created sources.list file to support multiple repositories 122 | - Added Conraid's repository to sources.list by default 123 | - Changed installation directory to /boot/extra 124 | - Redone download, installation and remove functions 125 | - Added 'installed' option, to list installed packages by un-get 126 | - Added 'changelog' option 127 | - Changed search to show both installed and non installed packages which are availabel in repositories 128 | - Added 'upgrade' function 129 | - Speed up search by a bit 130 | - Clarified remove message when no packages where found 131 | - Fixed bug where packages won't be removed after calling 'remove' function 132 | - Fixed bug where error was displayed if installedpackages_list file where not in place 133 | 134 | ###2022.08.20 135 | - Initial release from pkg-get 136 | 137 | 138 | 139 | 140 | 141 | rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null|grep -v '&version;') 142 | 143 | 144 | 145 | 146 | &gitURL;/&version;/&name;-&version;.txz 147 | &md5; 148 | 149 | 150 | 151 | 152 | **un-get** 153 | 154 | un-get is a simple command line tool to install/update/remove Slackware packages to unRAID. 155 | Start by opening a Terminal and type in 'un-get --help' 156 | 157 | 158 | 159 | 160 | 161 | 162 | # Create sources list file with the initial repositories 163 | if [ ! -f /boot/config/plugins/un-get/sources.list ]; then 164 | if [ ! -d /boot/config/plugins/un-get ]; then 165 | mkdir -p /boot/config/plugins/un-get 166 | fi 167 | echo "https://mirrors.slackware.com/slackware/slackware64-current/slackware64/ current 168 | https://slackers.it/repository/slackware64-current/ conraid" > /boot/config/plugins/un-get/sources.list 169 | fi 170 | 171 | # Check conraid repo URL and change it if it still points to the old URL 172 | sed -i 's/https:\/\/slack\.conraid\.net\/repository\/slackware64-current\/ conraid/https:\/\/slackers\.it\/repository\/slackware64-current\/ conraid/' /boot/config/plugins/un-get/sources.list 173 | 174 | 175 | # Create packages file 176 | if [ ! -f /boot/config/plugins/un-get/installedpackages_list ]; then 177 | touch /boot/config/plugins/un-get/installedpackages_list 178 | fi 179 | 180 | # Create symlink so that un-get is available system wide 181 | if [ ! -L /usr/bin/un-get ]; then 182 | ln -s /usr/local/emhttp/plugins/un-get/un-get /usr/bin/un-get 183 | fi 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | echo "----------------------------------------" 192 | echo "----------Uninstalling un-get-----------" 193 | echo "----------------------------------------" 194 | # Remove plugin related files 195 | removepkg &name;-&version; 196 | while read package; do 197 | echo "Removing package: $package, please wait!" 198 | removepkg $package 2>/dev/null 199 | rm -f /boot/extra/$package 2>/dev/null 200 | done < "/boot/config/plugins/un-get/installedpackages_list" 201 | rm -rf /usr/local/emhttp/plugins/&name; 202 | rm -rf &plugin; 203 | rm -f /usr/bin/un-get 2>/dev/null 204 | rm -rf /tmp/un-get 2>/dev/null 205 | echo 206 | echo "----------------------------------------" 207 | echo "---Uninstallation of un-get complete!---" 208 | echo "----------------------------------------" 209 | echo 210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /source/usr/local/emhttp/plugins/un-get/un-get: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -f 3 | 4 | # Get installed packages 5 | # remove lines which are empty and which has no numbers in it <- possible plugin packages 6 | INSTALLED_PKGS="$(ls -1 /var/log/packages/)" 7 | 8 | download_checksums() { 9 | echo "Please wait obtaining checksums from repository $2..." 10 | if wget -q --show-progress --progress=dot:mega -O /tmp/un-get/checksums-${2} "${1}/CHECKSUMS.md5" ; then 11 | echo "Checksums from repository $2 successfully downloaded!" 12 | if [ -f /tmp/un-get/filelist-${2}.old ]; then 13 | rm -f /tmp/un-get/filelist-${2}.old /tmp/un-get/checksums-${2}.old 14 | fi 15 | else 16 | rm -f /tmp/un-get/filelist-${2} 17 | rm -f /tmp/un-get/checksums-${2} 18 | if [ -f /tmp/un-get/filelist-${2}.old ]; then 19 | echo "Can't fetch package list from repository $2, restoring old list, please try again later...!" 20 | mv /tmp/un-get/filelist-${2}.old /tmp/un-get/filelist-${2} 21 | mv /tmp/un-get/checksums-${2}.old /tmp/un-get/checksums-${2} 22 | else 23 | echo "Can't fetch checksums from repository $2, please try again later...!" 24 | fi 25 | fi 26 | } 27 | 28 | download_filelist() { 29 | echo "Please wait obtaining package list from repository $2..." 30 | if wget -q --show-progress --progress=dot:mega -O /tmp/un-get/filelist-${2} "${1}/FILE_LIST" ; then 31 | echo "Package list from repository $2 successfully downloaded!" 32 | echo 33 | download_checksums "$1" "$2" 34 | else 35 | # Workaround from repositories which use 'FILELIST.TXT' instead of 'FILE_LIST' eg. Conraids repository 36 | if wget -q --show-progress --progress=dot:mega -O /tmp/un-get/filelist-${2} "${1}/FILELIST.TXT" ; then 37 | echo "Package list from repository $2 successfully downloaded!" 38 | echo 39 | download_checksums "$1" "$2" 40 | else 41 | rm -f /tmp/un-get/filelist-${2} 42 | if [ -f /tmp/un-get/filelist-${2}.old ]; then 43 | echo "Can't fetch package list, restoring old list, please try again later...!" 44 | mv /tmp/un-get/filelist-${2}.old /tmp/un-get/filelist-${2} 45 | mv /tmp/un-get/checksums-${2}.old /tmp/un-get/checksums-${2} 46 | else 47 | echo "Can't fetch package list from repository $2, please try again later...!" 48 | fi 49 | fi 50 | fi 51 | } 52 | 53 | update() { 54 | # Create folder if non exists 55 | if [ ! -d /tmp/un-get ]; then 56 | mkdir -p /tmp/un-get 57 | fi 58 | 59 | # Check for sources.list file 60 | # Read sources.list file and download packagelists 61 | while read source; do 62 | if [ "${source::1}" != "#" ]; then 63 | download_filelist "${source% *}" "${source##* }" 64 | if [ -z "${SOURCES}" ]; then 65 | SOURCES="${source##* }" 66 | else 67 | SOURCES="${SOURCES}|${source##* }" 68 | fi 69 | fi 70 | done <<< "$(cat /boot/config/plugins/un-get/sources.list | sed '/^$/d')" 71 | if [ ! -z ${SOURCES} ]; then 72 | rm -f $(find /tmp/un-get/ -type f | grep -Ev "${SOURCES}") 73 | fi 74 | } 75 | 76 | download_package() { 77 | if [ ! -d /boot/extra ]; then 78 | mkdir -p /boot/extra 79 | fi 80 | if [ ! -f /boot/config/plugins/un-get/installedpackages_list ]; then 81 | touch /boot/config/plugins/un-get/installedpackages_list 82 | fi 83 | if wget -q --show-progress --progress=dot:mega -O /boot/extra/${3##*/} "${2}/$3" ; then 84 | if [ ! "$(grep "${3##*/}" /boot/config/plugins/un-get/installedpackages_list)" ]; then 85 | echo "${3##*/}" >> /boot/config/plugins/un-get/installedpackages_list 86 | fi 87 | else 88 | rm -f /boot/extra/${3##*/} 2>/dev/null 89 | echo $3 90 | echo "Can't download package $1, please try again later...!" 91 | exit 1 92 | fi 93 | } 94 | 95 | install_package() { 96 | if [ "$(grep "^$1" /boot/config/plugins/un-get/installedpackages_list)" ]; then 97 | if [ "$(grep "${1%.*}" <<< "${INSTALLED_PKGS}")" ]; then 98 | echo "Package $1 already installed, skipping!" 99 | else 100 | if [ "$(cat /tmp/un-get/checksums-${2} | grep -w "$1" | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | awk '{print $1}')" == "$(md5sum /boot/extra/$1 | awk '{print $1}')" ]; then 101 | upgradepkg --install-new /boot/extra/$1 102 | else 103 | echo "Checksum error, please try to reinstall the package again!" 104 | rm /boot/extra/$1 2>/dev/null 105 | sed -i "/$1/d" /boot/config/plugins/un-get/installedpackages_list 106 | fi 107 | fi 108 | else 109 | echo "Something went wrong, package $1 not found" 110 | fi 111 | } 112 | 113 | upgrade_package() { 114 | OLD_PKG="$(ls -1 /boot/extra/ | grep "^$1-[0-9]")" 115 | sed -i "/$1/d" /boot/config/plugins/un-get/installedpackages_list 116 | if wget -q --show-progress --progress=dot:mega -O /boot/extra/${3##*/} "${2}/$3" ; then 117 | sed -i "/$1/d" /boot/config/plugins/un-get/installedpackages_list 118 | rm -f /boot/extra/${OLD_PKG} 2>/dev/null 119 | echo "${3##*/}" >> /boot/config/plugins/un-get/installedpackages_list 120 | else 121 | rm -f /boot/extra/${3##*/} 2>/dev/null 122 | echo "Can't download package $1, please try again later...!" 123 | exit 1 124 | fi 125 | } 126 | 127 | force_upgrade_package() { 128 | OLD_PKG="$(ls -1 /boot/extra/ | grep "^$1-[0-9]")" 129 | mv /boot/extra/${OLD_PKG} /tmp/un-get_temp/ 2>/dev/null 130 | sed -i "/$1/d" /boot/config/plugins/un-get/installedpackages_list 131 | if wget -q --show-progress --progress=dot:mega -O /boot/extra/${3##*/} "${2}/$3" ; then 132 | sed -i "/$1/d" /boot/config/plugins/un-get/installedpackages_list 133 | rm -f /tmp/un-get_temp/${OLD_PKG} 134 | echo "${3##*/}" >> /boot/config/plugins/un-get/installedpackages_list 135 | else 136 | rm -f /boot/extra/${3##*/} 2>/dev/null 137 | echo "Can't download package $1, please try again later...!" 138 | echo "Restoring old package ${OLD_PKG} to /boot/extra...!" 139 | mv /tmp/un-get_temp/${OLD_PKG} /boot/extra/ 2>/dev/null 140 | exit 1 141 | fi 142 | } 143 | 144 | remove_package() { 145 | removepkg "$(grep "^$1-[0-9]" <<< "${INSTALLED_PKGS}")" 146 | rm -f /boot/extra/$(ls -1 /boot/extra/ | grep "^$1-[0-9]") 2>/dev/null 147 | sed -i "/$1/d" /boot/config/plugins/un-get/installedpackages_list 148 | } 149 | 150 | list_installed() { 151 | if [ ! "$(find /boot/config/plugins/un-get/ -empty -name "installedpackages_list")" ] && [ -f /boot/config/plugins/un-get/installedpackages_list ]; then 152 | echo "Currently installed package(s) by un-get:" 153 | cat /boot/config/plugins/un-get/installedpackages_list 154 | else 155 | echo "No packages which are installed by un-get found!" 156 | fi 157 | } 158 | 159 | package_list_check() { 160 | if [ ! "$(find /tmp/un-get/ -name 'filelist-*' 2>/dev/null)" ]; then 161 | echo "Please run 'un-get update' first!" 162 | exit 1 163 | fi 164 | } 165 | 166 | package_installed_check() { 167 | if [ "$(echo "$INSTALLED_PKGS" | grep "^$1-[0-9]")" ]; then 168 | return 0 169 | else 170 | return 1 171 | fi 172 | } 173 | 174 | package_available_check() { 175 | if [ "$(echo "$PACKAGES_AVAILABLE" | grep "/$1-[0-9]")" ]; then 176 | return 0 177 | else 178 | return 1 179 | fi 180 | } 181 | 182 | package_installed_list_check() { 183 | if [ "$(echo "$PACKAGE_LIST_INSTALLED" | grep "^$1-[0-9]")" ]; then 184 | return 0 185 | else 186 | return 1 187 | fi 188 | } 189 | 190 | search() { 191 | PACKAGE_SEARCH="$(cat $(find /tmp/un-get/ -type f -name 'filelist-*') | grep -i "$1" | awk '{print $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | rev | cut -d '/' -f1 | rev)" 192 | if [ ! -z "${PACKAGE_SEARCH}" ]; then 193 | echo "Please wait, performing search..." 194 | for p in ${PACKAGE_SEARCH} 195 | do 196 | PACKAGE="$(echo ${p%-*-*})" 197 | package_installed_check "${PACKAGE%-*}" 198 | if [ "$?" == 0 ]; then 199 | if [ ! -z "${INSTALLED}" ]; then 200 | INSTALLED="${INSTALLED} ${PACKAGE%-*}" 201 | else 202 | INSTALLED="${PACKAGE%-*}" 203 | fi 204 | else 205 | if [ ! -z "${NOT_INSTALLED}" ]; then 206 | NOT_INSTALLED="${NOT_INSTALLED} ${PACKAGE}" 207 | else 208 | NOT_INSTALLED="${PACKAGE}" 209 | fi 210 | fi 211 | done 212 | if [ ! -z "${NOT_INSTALLED}" ]; then 213 | echo "Found the following package(s) for your search '$1' in repositories:" 214 | echo "${NOT_INSTALLED// /$'\n'}" 215 | if [ ! -z "${INSTALLED}" ]; then 216 | echo 217 | fi 218 | fi 219 | if [ ! -z "${INSTALLED}" ]; then 220 | echo "Found the following installed package(s) already installed on your" 221 | echo "system which are not qualifying for reinstall through un-get:" 222 | INSTALLED="${INSTALLED// /$'\n'}" 223 | echo "$(awk '!seen[$0]++' <<< "${INSTALLED}")" 224 | fi 225 | exit 0 226 | else 227 | echo "Found no packages matching your search '$1'." 228 | exit 1 229 | fi 230 | } 231 | 232 | install() { 233 | PACKAGES_AVAILABLE="$(cat $(find /tmp/un-get/ -type f -name 'filelist-*') | awk '{print $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1- | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256")" 234 | for p in $@ 235 | do 236 | package_available_check $p 237 | if [ "$?" == 0 ]; then 238 | package_installed_check $p 239 | if [ "$?" == 0 ]; then 240 | echo "Package $p is already installed on your system! ABORT!" 241 | exit 1 242 | fi 243 | if [ ! -z "${PACKAGE_LIST}" ]; then 244 | PACKAGE_LIST="${PACKAGE_LIST} $p" 245 | else 246 | PACKAGE_LIST="$p" 247 | fi 248 | else 249 | if [ ! -z "${FAILED_LIST}" ]; then 250 | FAILED_LIST="${FAILED_LIST} $p" 251 | else 252 | FAILED_LIST="$p" 253 | fi 254 | fi 255 | done 256 | if [ -z "${FAILED_LIST}" ]; then 257 | echo "The following package(s) will be installed: ${PACKAGE_LIST}" 258 | read -r -p "Are you sure? [y/N] " response 259 | response=${response,,} 260 | if [[ "$response" =~ ^(yes|y)$ ]]; then 261 | for p in ${PACKAGE_LIST} 262 | do 263 | LAT_V="$(grep -R -H -i -w "$p-[0-9a-zA-Z_]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | rev | cut -d '/' -f1 | rev | grep "^$p-[0-9]\+" | sort -V | tail -1)" 264 | PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1- | sort -V | tail -1)" 265 | TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')" 266 | REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | grep -vE '^[0-9]+:(http://|https://|ftp://|ftps://|www.|ftp.)' | cut -d ':' -f1)" 267 | URL="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $1}' | sed 's:/*$::')" 268 | download_package "$p" "${URL}" "${TOP_URL}" 269 | done 270 | for p in ${PACKAGE_LIST} 271 | do 272 | LAT_V="$(grep -R -H -i -w "$p-[0-9a-zA-Z_]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | rev | cut -d '/' -f1 | rev | grep "^$p-[0-9]\+" | sort -V | tail -1)" 273 | PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1- | sort -V | tail -1)" 274 | TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')" 275 | REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | grep -vE '^[0-9]+:(http://|https://|ftp://|ftps://|www.|ftp.)' | cut -d ':' -f1)" 276 | REPO="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $2}')" 277 | PACKAGE_NAME="$(grep "/$p-[0-9]" <<< "${PACKAGES_AVAILABLE}" | grep "${TOP_URL}" | sort -V | tail -1)" 278 | install_package "${PACKAGE_NAME##*/}" "${REPO}" 279 | done 280 | else 281 | echo "Abort!" 282 | exit 1 283 | fi 284 | else 285 | echo "Can't find package(s): ${FAILED_LIST// /, }!" 286 | exit 1 287 | fi 288 | } 289 | 290 | upgrade() { 291 | if [ ! "$(find /boot/config/plugins/un-get/ -empty -name "installedpackages_list")" ] && [ -f /boot/config/plugins/un-get/installedpackages_list ]; then 292 | INSTALLED_PACKAGES="$(cat /boot/config/plugins/un-get/installedpackages_list)" 293 | PACKAGES_AVAILABLE="$(grep -R "" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1-)" 294 | for p in ${INSTALLED_PACKAGES} 295 | do 296 | AVAIL_V="$(grep -w "${p%-*-*-*}-[0-9]" <<< $PACKAGES_AVAILABLE)" 297 | SORT_V="$(echo "$AVAIL_V" | rev | cut -d '/' -f1 | rev | sort -V | tail -1)" 298 | COMPARE="${SORT_V##*/} 299 | ${p}" 300 | SORTED="$(sort -V <<< "$COMPARE" | tail -1)" 301 | if [ "${p}" != "${SORTED}" ]; then 302 | if [ ! -z "${UPGRADE_PACKAGES}" ]; then 303 | UPGRADE_PACKAGES="${UPGRADE_PACKAGES} ${SORTED%-*-*-*}" 304 | else 305 | UPGRADE_PACKAGES="${SORTED%-*-*-*}" 306 | fi 307 | fi 308 | done 309 | if [ "${1}" == "force" ]; then 310 | INSTALLED_PACKAGES="$(cat /boot/config/plugins/un-get/installedpackages_list)" 311 | PACKAGES_AVAILABLE="$(grep -R "" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1-)" 312 | for p in ${INSTALLED_PACKAGES} 313 | do 314 | AVAIL_V="$(grep -w "${p%-*-*-*}-[0-9]" <<< $PACKAGES_AVAILABLE)" 315 | SORT_V="$(echo "$AVAIL_V" | rev | cut -d '/' -f1 | rev | sort -V | tail -1)" 316 | if [ -z "${SORT_V}" ]; then 317 | if [ ! -z "${NOT_FOUND}" ]; then 318 | NOT_FOUND="${NOT_FOUND} ${p%-*-*-*}" 319 | else 320 | NOT_FOUND="${p%-*-*-*}" 321 | fi 322 | elif [ ! -z "${UPGRADE_PACKAGES}" ]; then 323 | UPGRADE_PACKAGES="${UPGRADE_PACKAGES} ${SORT_V%-*-*-*}" 324 | else 325 | UPGRADE_PACKAGES="${SORT_V%-*-*-*}" 326 | fi 327 | done 328 | echo "Following packages will be force upgraded and installed on next boot:" 329 | echo "${UPGRADE_PACKAGES// /, }" 330 | if [ ! -z "${NOT_FOUND}" ]; then 331 | echo 332 | echo "ATTENTION" 333 | echo "The following packages could not be found and will be removed now" 334 | echo "after confirmation: ${NOT_FOUND// /, }" 335 | echo 336 | fi 337 | read -r -p "Are you sure? [y/N] " response 338 | response=${response,,} 339 | if [[ "$response" =~ ^(yes|y)$ ]]; then 340 | if [ ! -d /tmp/un-get_temp ]; then 341 | mkdir -p /tmp/un-get_temp 342 | fi 343 | for p in ${UPGRADE_PACKAGES} 344 | do 345 | LAT_V="$(grep -R -H -i -w "$p-[0-9a-zA-Z_]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | rev | cut -d '/' -f1 | rev | grep "^$p-[0-9]\+" | sort -V | tail -1)" 346 | PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1- | sort -V | tail -1)" 347 | TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')" 348 | REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | grep -vE '^[0-9]+:(http://|https://|ftp://|ftps://|www.|ftp.)' | cut -d ':' -f1)" 349 | URL="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $1}' | sed 's:/*$::')" 350 | force_upgrade_package "$p" "${URL}" "${TOP_URL}" 351 | done 352 | if [ ! -z "${NOT_FOUND}" ]; then 353 | for p in ${NOT_FOUND} 354 | do 355 | remove_package "$p" 356 | done 357 | fi 358 | rm -rf /tmp/un-get_temp 359 | echo 360 | echo "Please reboot your system to install the upgraded packages!" 361 | else 362 | echo "Abort!" 363 | exit 1 364 | fi 365 | elif [ ! -z "${UPGRADE_PACKAGES}" ]; then 366 | echo "Following packages will be upgraded: ${UPGRADE_PACKAGES// /, }" 367 | read -r -p "Are you sure? [y/N] " response 368 | response=${response,,} 369 | if [[ "$response" =~ ^(yes|y)$ ]]; then 370 | for p in ${UPGRADE_PACKAGES} 371 | do 372 | LAT_V="$(grep -R -H -i -w "$p-[0-9a-zA-Z_]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | rev | cut -d '/' -f1 | rev | grep "^$p-[0-9]\+" | sort -V | tail -1)" 373 | PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1- | sort -V | tail -1)" 374 | TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')" 375 | REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | grep -vE '^[0-9]+:(http://|https://|ftp://|ftps://|www.|ftp.)' | cut -d ':' -f1)" 376 | URL="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $1}' | sed 's:/*$::')" 377 | upgrade_package "$p" "${URL}" "${TOP_URL}" 378 | done 379 | for p in ${UPGRADE_PACKAGES} 380 | do 381 | LAT_V="$(grep -R -H -i -w "$p-[0-9a-zA-Z_]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | rev | cut -d '/' -f1 | rev | grep "^$p-[0-9]\+" | sort -V | tail -1)" 382 | PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5|.*\.sha256" | cut -d '.' -f1- | sort -V | tail -1)" 383 | TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')" 384 | REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | grep -vE '^[0-9]+:(http://|https://|ftp://|ftps://|www.|ftp.)' | cut -d ':' -f1)" 385 | REPO="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $2}')" 386 | PACKAGE_NAME="$(grep "/$p-[0-9]" <<< "${PACKAGES_AVAILABLE}" | grep "${TOP_URL}" | sort -V | tail -1)" 387 | install_package "${PACKAGE_NAME##*/}" "${REPO}" 388 | done 389 | else 390 | echo "Abort!" 391 | exit 1 392 | fi 393 | else 394 | echo "All your installed packages through un-get are up-to-date!" 395 | fi 396 | else 397 | echo "Nothing to upgrade, no packages which are installed by un-get found!" 398 | fi 399 | } 400 | 401 | remove() { 402 | PACKAGE_LIST_INSTALLED="$(cat /boot/config/plugins/un-get/installedpackages_list)" 403 | for p in $@ 404 | do 405 | package_installed_list_check $p 406 | if [ "$?" == 0 ]; then 407 | if [ ! -z "${PACKAGE_LIST}" ]; then 408 | PACKAGE_LIST="${PACKAGE_LIST} $p" 409 | else 410 | PACKAGE_LIST="$p" 411 | fi 412 | else 413 | if [ ! -z "${FAILED_LIST}" ]; then 414 | FAILED_LIST="${FAILED_LIST} $p" 415 | else 416 | FAILED_LIST="$p" 417 | fi 418 | fi 419 | done 420 | if [ -z "${FAILED_LIST}" ]; then 421 | echo "The following package(s) will be removed: ${PACKAGE_LIST}" 422 | read -r -p "Are you sure? [y/N] " response 423 | response=${response,,} 424 | if [[ "$response" =~ ^(yes|y)$ ]]; then 425 | for p in ${PACKAGE_LIST} 426 | do 427 | remove_package "$p" 428 | done 429 | else 430 | echo "Abort!" 431 | exit 1 432 | fi 433 | else 434 | echo "Can't find any package(s) named: ${FAILED_LIST// /, } installed by un-get!" 435 | exit 1 436 | fi 437 | } 438 | 439 | cleanup() { 440 | BOOT_PKGS="$(ls -1 /boot/extra/)" 441 | PACKAGE_LIST_INSTALLED="$(cat /boot/config/plugins/un-get/installedpackages_list)" 442 | for p in ${BOOT_PKGS} 443 | do 444 | if [ $(grep "${p%.*}" <<< "${INSTALLED_PKGS}" | wc -l) -eq 0 ]; then 445 | if [ -z "${CLEANUP_LIST}" ]; then 446 | CLEANUP_LIST="${p}" 447 | else 448 | CLEANUP_LIST="${CLEANUP_LIST} ${p}" 449 | fi 450 | fi 451 | done 452 | if [ ! -z "${CLEANUP_LIST}" ]; then 453 | echo "Found the following package(s) which can be cleaned up:" 454 | echo "${CLEANUP_LIST// /, }" 455 | echo 456 | echo "This will will delete the above listed package(s) from '/boot/extra'" 457 | read -r -p "Are you sure? [y/N] " response 458 | response=${response,,} 459 | if [[ "$response" =~ ^(yes|y)$ ]]; then 460 | cd /boot/extra 461 | rm -f ${CLEANUP_LIST} 462 | fi 463 | echo 464 | echo "Please wait, checking if package list is up-to-date...!" 465 | for p in ${PACKAGE_LIST_INSTALLED} 466 | do 467 | if [ $(grep "${p%.*}" <<< "${INSTALLED_PKGS}" | wc -l) -eq 0 ]; then 468 | sed -i "/$p/d" /boot/config/plugins/un-get/installedpackages_list 469 | fi 470 | done 471 | echo "Done!" 472 | else 473 | echo "Nothing to clean up!" 474 | fi 475 | } 476 | 477 | usage_general() { 478 | echo "Slackware package installation tool for unRAID." 479 | echo 480 | echo "un-get is a package download and installation tool" 481 | echo "for unRAID for Slackware package repositories." 482 | echo 483 | echo "Most used commands are:" 484 | echo " update - Updates the packages list locally" 485 | echo " install - Downloads and installs packages" 486 | echo " upgrade - Upgrades packages installed by un-get" 487 | echo " Adding '--force' or '-f' will force an upgrade from all" 488 | echo " packages, the packages will be installed after a reboot." 489 | echo " This comes in handy if the repository is switched." 490 | echo " Missing packages from the new repository will be removed" 491 | echo " immediately after confirming the force upgrade!" 492 | echo " remove - Removes packages installed by un-get" 493 | echo " search - Searches for available packages" 494 | echo " installed - Lists all packages installed by un-get" 495 | echo " cleanup - Will remove all packages/files in the '/boot/extra' directory" 496 | echo " which are currently not installed on your server, regardless" 497 | echo " if they were installed through un-get or not" 498 | echo " ATTENTION: This will delete files which are not packages too" 499 | echo 500 | echo "Example usages:" 501 | echo " un-get update" 502 | echo " un-get search python" 503 | echo " un-get install python3 python-pip" 504 | echo " un-get remove python3 python-pip" 505 | echo " un-get installed" 506 | echo " un-get upgrade" 507 | echo " un-get upgrade --force" 508 | echo " un-get cleanup" 509 | echo 510 | echo "Written by Christoph Hummer for unRAID." 511 | exit 0 512 | } 513 | 514 | usage_search() { 515 | echo "Usage example:" 516 | echo " un-get search python3" 517 | echo 518 | echo "Search only accepts one package at a time!" 519 | echo "You don't have to specify wildcards!" 520 | exit 0 521 | } 522 | 523 | usage_install() { 524 | echo "Usage example:" 525 | echo " un-get install python3" 526 | echo " un-get install python-pip python-setuptools" 527 | exit 0 528 | } 529 | 530 | usage_remove() { 531 | echo "Usage example:" 532 | echo " un-get remove python3" 533 | echo " un-get remove python-pip python-setuptools" 534 | exit 0 535 | } 536 | 537 | version() { 538 | echo "Written by Christoph Hummer for unRAID." 539 | echo "$(grep "^Version: " /usr/local/emhttp/plugins/un-get/changelog | sort -V | tail -1)" 540 | echo "$(grep "^Date: " /usr/local/emhttp/plugins/un-get/changelog | sort -V | tail -1)" 541 | echo "Dual-licensed under MIT or UNLICENSE." 542 | exit 0 543 | } 544 | 545 | changelog() { 546 | cat /usr/local/emhttp/plugins/un-get/changelog 547 | } 548 | 549 | if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then 550 | usage_general 551 | exit 0 552 | elif [ "$1" == "-v" ] || [ "$1" == "--version" ]; then 553 | version 554 | exit 0 555 | elif [ "$1" == "install" ]; then 556 | package_list_check 557 | if [ $(expr $# - 1) -lt 1 ]; then 558 | usage_install 559 | exit 1 560 | elif [ "$(echo "${@:2}" | tr -dc '[:alnum:]\n\r')" == "pkgget" ]; then 561 | usage_install 562 | exit 1 563 | else 564 | install "${@:2}" 565 | fi 566 | elif [ "$1" == "remove" ]; then 567 | if [ $(expr $# - 1) -lt 1 ]; then 568 | usage_remove 569 | exit 1 570 | elif [ "$(echo "${@:2}" | tr -dc '[:alnum:]\n\r')" == "pkgget" ]; then 571 | usage_remove 572 | exit 1 573 | else 574 | remove "${@:2}" 575 | fi 576 | elif [ "$1" == "search" ]; then 577 | package_list_check 578 | if [ $(expr $# - 1) -lt 1 ]; then 579 | usage_search 580 | exit 1 581 | elif [ $(expr $# - 1) -gt 1 ]; then 582 | usage_search 583 | exit 1 584 | elif [ "$(echo "${@:2}" | tr -dc '[:alnum:]\n\r')" == "pkgget" ]; then 585 | usage_search 586 | exit 1 587 | else 588 | search "${@:2}" 589 | fi 590 | elif [ "$1" == "installed" ]; then 591 | list_installed 592 | elif [ "$1" == "upgrade" ] && [ "$2" == "--force" ] || [ "$2" == "-f" ]; then 593 | package_list_check 594 | upgrade "force" 595 | elif [ "$1" == "upgrade" ]; then 596 | package_list_check 597 | upgrade 598 | elif [ "$1" == "update" ]; then 599 | update 600 | elif [ "$1" == "cleanup" ]; then 601 | cleanup 602 | elif [ "$1" == "changelog" ]; then 603 | changelog 604 | elif [ -z "$1" ]; then 605 | usage_general 606 | exit 1 607 | else 608 | usage_general 609 | exit 1 610 | fi 611 | --------------------------------------------------------------------------------