| Hash | Commit message | Author | Date | Files | + | - |
1 | commit 2ca06983af0029cc7261846e44b3f5a873d3dc41 |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Sun May 15 21:24:55 2022 +0200 |
4 | |
5 | Auto-Commit Update 15.05.2022 - 21:24:55 |
6 | --- |
7 | PKGBUILD | 24 +++- |
8 | README.md | 62 +++++++++ |
9 | usr/bin/ezdl | 359 ++++++++++++++++++++++++++++++++++++++++++++++++ |
10 | usr/share/doc/README.md | 62 +++++++++ |
11 | 4 files changed, 500 insertions(+), 7 deletions(-) |
12 | |
13 | diff --git a/PKGBUILD b/PKGBUILD |
14 | index 2f0b45b..630c8cb 100644 |
15 | --- a/PKGBUILD |
16 | +++ b/PKGBUILD |
17 | @@ -1,17 +1,27 @@ |
18 | # Maintainer: Connor Etherington <[email protected]> |
19 | # --- |
20 | -pkgname= |
21 | +pkgname=pkd |
22 | pkgver=1.0.1 |
23 | pkgrel=1 |
24 | -pkgdesc= |
25 | -arch=() |
26 | +pkgdesc="A minimal CLI download manager for all major package managers and URLs/Torrents" |
27 | +arch=(any) |
28 | url="https://gitlab.com/a4to/${pkgname}" |
29 | license=('MIT') |
30 | -depends=() |
31 | -source=("git+.git") |
32 | +depends=(dialog) |
33 | +optdepends=( |
34 | + "git: To clone git repositories" |
35 | + "npm: To download npm packages." |
36 | + "snapd: To download and install snap packages." |
37 | + "flatpak: To download and install flatpak packages." |
38 | + "python-pip: To download python packages." |
39 | + "aria2: To download files or torrents from URLs." |
40 | + ) |
41 | +source=("git+$url.git") |
42 | sha256sums=('SKIP') |
43 | |
44 | package() { |
45 | - install -Dm644 usr/share/licenses//LICENSE "/usr/share/licenses//LICENSE" |
46 | - install -Dm755 usr/bin/ |
47 | + install -Dm644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" |
48 | + install -Dm644 usr/share/doc/${pkgname}/README "${pkgdir}/usr/share/licenses/${pkgname}/README" |
49 | + install -Dm755 usr/bin/${pkgname} "${pkgdir}/usr/bin/${pkgname}" |
50 | } |
51 | [41m+ |
52 | diff --git a/README.md b/README.md |
53 | new file mode 100644 |
54 | index 0000000..a71fad5 |
55 | --- /dev/null |
56 | +++ b/README.md |
57 | @@ -0,0 +1,62 @@ |
58 | +## PKD - A minimal terminal-based download manager. |
59 | + |
60 | +This Script is intended to be used as a donload helper for all major package managers, |
61 | +as well as for obtaining Torrents and files from URLs. |
62 | + |
63 | +## Usage |
64 | + |
65 | +Run `pkd` - you will be taken to a file where you can enter the package names and sources that you want to download. |
66 | + |
67 | +**Other use cases:** |
68 | + |
69 | +`pkd` -f <file with list of packages> |
70 | + |
71 | +`pkd` <package1> <package2> <package3> |
72 | + |
73 | +`pkd` MH,<repo> |
74 | + |
75 | +`pkd` L,<gitlab username>/<repo> |
76 | + |
77 | +`pkd` H,<github username>/<repo> |
78 | + |
79 | + |
80 | +## List Formattiing |
81 | + |
82 | +Do not enter any spaces between package names, between package source and package name (the comma). |
83 | + |
84 | + |
85 | +**The following list is provided below for reference:** |
86 | +--- |
87 | + |
88 | +Local or AUR Packages : 'packageName,"Comment here (optional)"' # This is most likely to be the most commonly used format. |
89 | + |
90 | +GitHub Repositories : 'H,Creator/HubRepoName,"Comment here (optional)"' |
91 | + |
92 | +GitLab Repositories : 'L,Creator/LabRepoName,"Comment here (optional)"' |
93 | + |
94 | +Personal GitHub : 'PH,yourGitHubRepoName,"Comment here (optional)"' |
95 | + |
96 | +Personal GitLab : 'PL,yourGitLabRepoName,"Comment here (optional)"' |
97 | + |
98 | +Snap Packages : 'S,snapPackageName,"Comment here (optional)"' |
99 | + |
100 | +Python Pip Packages : 'P,pythonPackageName,"Comment here (optional)"' |
101 | + |
102 | +NPM or Nodejs Packages : 'N,packageName,"Comment here (optional)"' |
103 | + |
104 | +Web files or Torrents : 'W,URL,"Comment here (optional)" |
105 | + |
106 | + |
107 | +## List Formatting Examples: |
108 | +[41m |
109 | +packages=( |
110 | + |
111 | +zsh,"A very advanced and programmable command interpreter (shell) for UNIX" |
112 | +H,neovim/neovim |
113 | +P,pipenv,"A comment is not necessary and purely meant as eye candy if saving the script for later use" |
114 | +L,a4to/nu1ll1nux |
115 | +S,snap-store |
116 | +N,lite-server |
117 | + |
118 | + ) |
119 | + |
120 | diff --git a/usr/bin/ezdl b/usr/bin/ezdl |
121 | new file mode 100755 |
122 | index 0000000..33fd04a |
123 | --- /dev/null |
124 | +++ b/usr/bin/ezdl |
125 | @@ -0,0 +1,359 @@ |
126 | +#!/usr/bin/env bash |
127 | +####################################################################################################################################################################################### |
128 | +# ~ A U T O M A T E D O W N L O A D H E L P E R ~ # |
129 | +####################################################################################################################################################################################### |
130 | + |
131 | +TITLE=" ~ Automate Download Helper ~ " |
132 | + |
133 | +multiDownlist=$(mktemp -uq) |
134 | + |
135 | +trap 'sudo rm -f ${multiDownlist} /tmp/total.tmp >/dev/null 2>&1' EXIT INT TERM HUP QUIT >/dev/null 2>&1 |
136 | + |
137 | +cat <<-EOF > ${multiDownlist} |
138 | +## PLEASE ENTER YOUR DESIRED SOURCES AND PACKAGES BELOW : ( No source assumes pkg is in package database or AUR ) |
139 | + |
140 | +packages=( |
141 | + |
142 | + |
143 | + |
144 | + ) |
145 | + |
146 | + |
147 | +## If you wish to clone personal GitHub or GitLab repositories,[41m |
148 | +## please enter your own GitHub and/or GitLab username below: |
149 | + |
150 | +# GitHub / GitLab Usernames : |
151 | + |
152 | +hubname="" |
153 | +labname="" |
154 | + |
155 | + |
156 | + |
157 | +## Optionally, you can change the color scheme to your prefrence below. |
158 | +# Your options are as follows: ( blue, green, red, yellow, white, pink or random )[41m |
159 | + |
160 | +color1="blue" # Total Count |
161 | +color2="pink" # Package Name |
162 | +color3="yellow" # Package Description |
163 | + |
164 | + |
165 | +## PREFIXES AND FORMATTING: |
166 | +#--- |
167 | + |
168 | +# Pacman/AUR Package : <package-name> |
169 | + |
170 | +# Gitlab Repo : L,<gitlab-username>/<repo-name>[41m |
171 | +# GitHub Repo : H,<github-username>/<repo-name> |
172 | + |
173 | +# Npm Package : N,<package-name> |
174 | +# Snap Package : S,<package-name> |
175 | +# Flatpak Package : F,<package-name> |
176 | +# Python Package : P,<package-name> |
177 | + |
178 | +# Personal GitLab Repo : ML,<repo-name> |
179 | +# Personal GitHub Repo : MH,<repo-name> |
180 | + |
181 | +# Web File / Torrent : W,<URL> |
182 | + |
183 | + |
184 | +# See /usr/share/doc/pkgdl/README for more information on list formatting. |
185 | + |
186 | +################################################################################################################################ |
187 | +################################################################################################################################ |
188 | +EOF |
189 | + |
190 | + |
191 | +name="$(echo "$USER")" |
192 | + |
193 | + |
194 | +[ -n $(echo $color1) ] || [ ! $color1 ] && color1=blue |
195 | + |
196 | +[ -n $(echo $color2) ] || [ ! $color2 ] && color2=pink |
197 | + |
198 | +[ -n $(echo $color3) ] || [ ! $color3 ] && color3=yellow |
199 | + |
200 | + |
201 | +yellow(){ echo -n "$(tput bold; tput setaf 3)${*}$(tput sgr0)" ; } |
202 | + |
203 | +blue() { echo -n "$(tput bold; tput setaf 6)${*}$(tput sgr0)" ; } |
204 | + |
205 | +white() { echo -n "$(tput bold; tput setaf 7)${*}$(tput sgr0)" ; } |
206 | + |
207 | +pink() { echo -n "$(tput bold; tput setaf 5)${*}$(tput sgr0)" ; } |
208 | + |
209 | +red() { echo -en "$(tput bold; tput setaf 1)${*}$(tput sgr0)" ; } |
210 | + |
211 | +green() { echo -n "$(tput bold; tput setaf 2)${*}$(tput sgr0)" ; } |
212 | + |
213 | +msg() { echo -e "$(tput bold; tput setaf 2)${*}$(tput sgr0)" ; } |
214 | + |
215 | +random(){ echo -n "$(tput bold; tput setaf "$(seq 25|shuf|head -1)") ${*}$(tput sgr0)" ; } |
216 | + |
217 | +err() { clear ; echo -e "\n$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)" && exit 1337 ; } |
218 | + |
219 | + |
220 | +scrstart() { clear ; echo -e "\n\n" ; green " Downloading Packages : " ; echo -e "\n\n" ||[41m |
221 | + red "\n [-] ERROR: Could Not Find '"$1"'\n\n" ; } |
222 | + |
223 | + |
224 | +npminstall() { sudo -u "$name" npm install -g "$1" "$npmd"/"$pkg" >/dev/null 2>&1 ||[41m |
225 | + ! sudo pacman -Qq npm >/dev/null 2>&1 && err "NPM is not installed. Please install it and try again." || |
226 | + red "\n [-] ERROR: Could Not Find '"$1"' in NPM database.\n\n" ; } |
227 | + |
228 | +snpinstall() { sudo -u "$name" snap install "$1" >/dev/null 2>&1 ||[41m |
229 | + ! sudo pacman -Qq snapd >/dev/null 2>&1 && err "Snapd is not installed. Please install it and try again." || |
230 | + red "\n [-] ERROR: Could Not Find '"$1"'in Snap database.\n\n" ; } |
231 | + |
232 | +pkginstall() { ${helper} -S --needed --noconfirm "$1" >/dev/null 2>&1 && return 0 ||[41m |
233 | + $( ${helper} -Si "$1" >/dev/null 2>&1) &&[41m |
234 | + red "\n [-] Errors occurred during install of ${1}. Most likely due to conflicting packages.\n\n" || |
235 | + red "\n [-] ERROR: '"$1"' could not be found in package database.\n\n" ; } |
236 | + |
237 | +pipinstall() { sudo -u "$name" python3 -m pip install "$1" "$pipd"/"$pkg" >/dev/null 2>&1 ||[41m |
238 | + ! sudo pacman -Qq python-pip >/dev/null 2>&1 && err "Python-pip is not installed. Please install it and try again." || |
239 | + red "\n [-] ERROR: Could Not Find '"$1"' in Python database.\n\n" ; } |
240 | + |
241 | +flatinstall() { sudo -u "$name" flatpak install -y "$1" >/dev/null 2>&1 || |
242 | + ! sudo pacman -Qq flatpak >/dev/null 2>&1 && err "Flatpak is not installed. Please install it and try again." || |
243 | + red "\n [-] ERROR: Could Not Find '"$1"' in Flatpak database.\n\n" ; } |
244 | + |
245 | +labclone() { git clone https://gitlab.com/"$1".git \ |
246 | + ! sudo pacman -Qq git >/dev/null 2>&1 && err "Git is not installed. Please install it and try again." || |
247 | + >/dev/null 2>&1 || red "\n [-] ERROR: Could Not Find '"$1"' Git repo.\n\n" ; } |
248 | + |
249 | +mylabclone() { git clone https://gitlab.com/"$labname"/"$(basename $1)".git \ |
250 | + ! sudo pacman -Qq git >/dev/null 2>&1 && err "Git is not installed. Please install it and try again." || |
251 | + >/dev/null 2>&1 || red "\n [-] ERROR: Could Not Find '"$1"' Git repo.\n\n" ; } |
252 | + |
253 | +myhubclone() { git clone https://github.com/"$hubname"/"$(basename $1)".git \ |
254 | + ! sudo pacman -Qq git >/dev/null 2>&1 && err "Git is not installed. Please install it and try again." || |
255 | + >/dev/null 2>&1 || red "\n [-] ERROR: Could Not Find '"$1"' Git repo.\n\n" ; } |
256 | + |
257 | +hubclone() { git clone https://github.com/"$1".git \ |
258 | + ! sudo pacman -Qq git >/dev/null 2>&1 && err "Git is not installed. Please install it and try again." || |
259 | + >/dev/null 2>&1 || red "\n [-] ERROR: Could Not Find '"$1"' Git repo.\n\n" ; } |
260 | + |
261 | +lnOrTorrent() { aria2c "${1}" >/dev/null 2>&1 ||[41m |
262 | + ! sudo pacman -Qq aria2 >/dev/null 2>&1 && err "NPM is not installed. Please install it and try again." || |
263 | + red "\n [-] ERROR: "$1", Could not be download.\n\n" ; } |
264 | + |
265 | + |
266 | +testLocal(){ \ |
267 | + sudo pacman -Qi ${1} |grep "^Install Date.*" >/dev/null 2>&1 && return 0 || dialog \ |
268 | + --title "$TITLE" \ |
269 | + --yes-label 'Yes, Install It.' \ |
270 | + --no-label 'No Nevermind.' \ |
271 | + --yesno "\\n${1} cannot be found locally on the system, would you like to install it now?" 6 90 || exit 1 |
272 | +[41m |
273 | + dialog \ |
274 | + --title "$TITLE" \ |
275 | + --infobox "\\nInstalling ${1} ..." 6 35 |
276 | +[41m |
277 | + sudo pacman -S --noconfirm ${1} >/dev/null 2>&1 && return 0 |
278 | + |
279 | + ${helper} -S --noconfirm ${1} >/dev/null 2>&1 && return 0 ||[41m |
280 | + err "${1} could not be installed. Please install it manually." ; } |
281 | + |
282 | + |
283 | +printHelp(){ cat /usr/share/doc/ez/ezdl/README && exit 0 ; } |
284 | + |
285 | +getEditor(){ |
286 | + |
287 | +editorSel=( |
288 | + '1' 'Neovim' |
289 | + '2' 'Vim' |
290 | + '3' 'Nano' |
291 | + '4' 'Emacs' |
292 | + '5' 'VS Code' |
293 | + '6' 'Atom' |
294 | + '7' 'Leafpad' |
295 | + '8' 'Notepadqq' |
296 | + '9' 'Gedit' |
297 | + '10' 'Enter Manually' |
298 | +) |
299 | + |
300 | +editorChoice=$(dialog \ |
301 | + --stdout \ |
302 | + --title "$TITLE " \ |
303 | + --menu "\\n Please select your preferred text editor:\\n\\n\\nNOTE: This will only be asked once, after which, can be changed by editing the config file located at '${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc'\\n\\nFor convenience, a terminal based editor is recommended.\\n " 16 80 0 \ |
304 | + "${editorSel[@]}") |
305 | + |
306 | +[ -z $editorChoice ] && err "No editor selected ..." |
307 | + |
308 | +case $editorChoice in |
309 | + 1) export editor="nvim" ; export editorName="neovim" ;; |
310 | + 2) export editor="vim" ; export editorName="vim" ;; |
311 | + 3) export editor="nano" ; export editorName="nano" ;; |
312 | + 4) export editor="emacs" ; export editorName="emacs" ;; |
313 | + 5) export editor="code" ; export editorName="code" ;; |
314 | + 6) export editor="atom" ; export editorName="atom" ;; |
315 | + 7) export editor="leafpad" ; export editorName="leafpad" ;; |
316 | + 8) export editor="notepadqq" ; export editorName="notepadqq" ;; |
317 | + 9) export editor="gedit" ; export editorName="gedit" ;; |
318 | + 10) export editor=$(dialog --stdout --title "$TITLE " \ |
319 | + --inputbox "Please enter the full name of your preferred text editor:" 10 65) |
320 | + export editorName=${editor} ;; |
321 | +esac |
322 | + |
323 | +testLocal ${editorName} |
324 | + |
325 | +[ ! -f ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc ] && |
326 | + echo -e "# ~ PKD Config File ~ #\n\n"\ |
327 | + >> ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc[41m |
328 | + |
329 | +! cat ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc >/dev/null 2>&1 | grep -q "editor" &&[41m |
330 | + echo "editor=\"${editor}\"" >> ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc ||[41m |
331 | + sed -i "s/editor=.*/editor=\"${editor}\"/" ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc ; } |
332 | + |
333 | + |
334 | +getHelper(){ |
335 | + |
336 | +helperSel=( |
337 | + '1' 'Yay' |
338 | + '2' 'Paru' |
339 | + '3' 'Trizen' |
340 | + '4' 'Pacaur' |
341 | +) |
342 | + |
343 | +helperChoice=$(dialog \ |
344 | + --stdout \ |
345 | + --title "$TITLE " \ |
346 | + --menu "\\n Please select your preferred AUR helper:\\n\\n\\nNOTE: This will only be asked once, after which, can be changed by editing the config file located at '${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc'\\n " 14 80 0 \ |
347 | + "${helperSel[@]}") |
348 | + |
349 | +[ -z $helperChoice ] && err "No editor selected ..." |
350 | + |
351 | +case $helperChoice in |
352 | + 1) helperName=yay ; for help in yay yay-bin yay-git; do sudo pacman -Qq $help >/dev/null 2>&1 && export helper=yay && break ; done ;; |
353 | + 2) helperName=paru ; for help in paru paru-bin paru-git; do sudo pacman -Qq $help >/dev/null 2>&1 && export helper=paru && break ; done ;; |
354 | + 3) helperName=trizen ; for help in trizen trizen-bin trizen-git; do sudo pacman -Qq $help >/dev/null 2>&1 && export helper=trizen && break ; done ;; |
355 | + 4) helperName=pacaur ; for help in pacaur pacaur-bin pacaur-git; do sudo pacman -Qq $help >/dev/null 2>&1 && export helper=pacaur && break ; done ;; |
356 | +esac |
357 | + |
358 | +[ -z $helper ] && dialog \ |
359 | + --title "$TITLE" \ |
360 | + --yes-label 'Yes, Install It.' \ |
361 | + --no-label 'No Nevermind.' \ |
362 | + --yesno "\\nThe selected AUR helper was not found on your system, would you like to install it now?" 6 95 |
363 | + |
364 | +fetchHelper=$? |
365 | +[41m |
366 | +[ $fetchHelper = 0 ] && dialog \ |
367 | + --title "$TITLE" \ |
368 | + --infobox "\\nInstalling ${helperName} ..." 6 35 && eval $(\ |
369 | + sudo pacman -S --noconfirm --needed git >/dev/null 2>&1[41m |
370 | +[ "$(id -u)" -eq 0 ] && err "Please run this script as a normal user, not with elevated privileges (sudo)." |
371 | +git clone https://aur.archlinux.org/${helperName}.git /tmp/${helperName}.$$ >/dev/null 2>&1[41m |
372 | + |
373 | +cd /tmp/${helperName}.$$ &&[41m |
374 | + makepkg -sri --noconfirm >/dev/null 2>&1 && cd ~/ &&[41m |
375 | + sudo rm -rf /tmp/${helperName}.$$ >/dev/null 2>&1 || |
376 | + err "Could not install ${helperName}. Please install it manually.") |
377 | + |
378 | +! cat ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc >/dev/null 2>&1 | grep -q "helper" && |
379 | + echo -e "helper=\"${helperName}\"" >> ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc ||[41m |
380 | + sed -i "s/helper=.*/helper=\"${helperName}\"/" ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc ; } |
381 | + |
382 | + |
383 | + |
384 | +# Script Start: |
385 | + |
386 | + |
387 | +! [ -d ${XDG_DATA_HOME:-$HOME/.local/share}/PKD ] && mkdir -p ${XDG_DATA_HOME:-$HOME/.local/share}/PKD |
388 | + |
389 | + |
390 | +source ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc |
391 | + |
392 | +[ -z ${editor} ] && getEditor |
393 | + |
394 | +[ -z ${helper} ] && getHelper |
395 | + |
396 | +source ${XDG_DATA_HOME:-$HOME/.local/share}/PKD/pkdrc |
397 | + |
398 | + |
399 | + |
400 | +case ${1} in |
401 | +[41m |
402 | + -h|--help) printHelp ;; |
403 | +[41m |
404 | + -f) echo "packages=(" >${multiDownlist} ;[41m |
405 | + |
406 | + for CAT in ${@} ; do |
407 | + |
408 | + cat "${CAT}" >>$multiDownlist |
409 | + |
410 | + done ; echo ')' >>$multiDownlist |
411 | + |
412 | + source ${multiDownlist} ;; |
413 | +[41m |
414 | + '') $editor $multiDownlist && source $multiDownlist ;; |
415 | + |
416 | + *) packages=( ${@} ) ;; |
417 | + |
418 | +esac |
419 | + |
420 | + |
421 | +[ -z $packages ] && err "No packages specified ..." |
422 | + |
423 | + |
424 | +[ -f /tmp/total.tmp ] && rm /tmp/total.tmp |
425 | + |
426 | +for x in "${packages[@]}" ; do[41m |
427 | + |
428 | + echo $x >> /tmp/total.tmp[41m |
429 | +[41m |
430 | + sed -i '/^\s*$/d;/^#/d' /tmp/total.tmp[41m |
431 | + |
432 | + done ; scrstart |
433 | + |
434 | + |
435 | +while IFS=, read -r src pkg desc viewName ; do |
436 | + |
437 | + [[ -z ${pkg} ]] && pkg="${src}" && unset src |
438 | + |
439 | + [[ -z ${desc} ]] && [[ -z ${src} ]] && desc="$( ${helper} -Si ${pkg} 2>/dev/null|grep 'Description'|cut -d: -f2-|sed 's/^\s*//')" |
440 | + |
441 | + viewName="${pkg}" |
442 | + |
443 | +[41m |
444 | + echo ${pkg}|grep -q "^http.*" || echo ${pkg}|grep -q "^www.*" || echo ${pkg}|grep -q "^magnet:\?.*" &&[41m |
445 | + src='W' && viewName="$(basename ${pkg})" |
446 | + |
447 | + |
448 | + [[ ${src} == 'W' ]] && [[ -z ${desc} ]] && desc="Downloading Link..." |
449 | + |
450 | + |
451 | + [[ ${src} == 'W' ]] && echo ${pkg} | grep -q "\.torrent$" || echo ${pkg} | grep -q "^magnet:\?.*" &&[41m |
452 | + viewName="Downloading Torrent File..." && desc="" |
453 | + |
454 | + |
455 | + [[ ${src} == 'L' ]] && [[ -z ${desc} ]] && desc="Cloning from Gitlab..." |
456 | +[41m |
457 | + [[ ${src} == 'H' ]] && [[ -z ${desc} ]] && desc="Cloning from Github..." |
458 | + |
459 | + |
460 | + ((n=$n+1)) ; total=$(wc -l < /tmp/total.tmp) ;[41m |
461 | +[41m |
462 | + $color1 "( $n of $total ) "[41m |
463 | + |
464 | + $color2 $viewName && [ -n "$(echo "$desc")" ] && green " - " && $color3 "$desc" ; echo "" |
465 | +[41m |
466 | + |
467 | +case "$src" in |
468 | + |
469 | + "W") lnOrTorrent "$pkg" ;; "L") labclone "$pkg" ;; "ML") mylabclone "$pkg" ;;[41m |
470 | + |
471 | + "S") snpinstall "$pkg" ;; "N") npminstall "$pkg" ;; "H") hubclone "$pkg" ;;[41m |
472 | + |
473 | + "MH") myhubclone "$pkg" ;; "") pkginstall "$pkg" ;; "P") pipinstall "$pkg" ;;[41m |
474 | +[41m |
475 | + "F") flatinstall "$pkg" ;; *) echo -e "\n" && err ""$src" is not a valid option for a source. - skipping: "$src" ..." |
476 | +[41m |
477 | + echo -e "\n" ; sleep 2 ;; esac ; done < /tmp/total.tmp || exit 1 |
478 | + |
479 | +msg "\n\n\n[+] Download Complete.\n" && sleep 1 && exit 0 || exit 1 |
480 | + |
481 | + |
482 | +############################################################################################################################## |
483 | +############################################################################################################################## |
484 | + |
485 | diff --git a/usr/share/doc/README.md b/usr/share/doc/README.md |
486 | new file mode 100644 |
487 | index 0000000..a71fad5 |
488 | --- /dev/null |
489 | +++ b/usr/share/doc/README.md |
490 | @@ -0,0 +1,62 @@ |
491 | +## PKD - A minimal terminal-based download manager. |
492 | + |
493 | +This Script is intended to be used as a donload helper for all major package managers, |
494 | +as well as for obtaining Torrents and files from URLs. |
495 | + |
496 | +## Usage |
497 | + |
498 | +Run `pkd` - you will be taken to a file where you can enter the package names and sources that you want to download. |
499 | + |
500 | +**Other use cases:** |
501 | + |
502 | +`pkd` -f <file with list of packages> |
503 | + |
504 | +`pkd` <package1> <package2> <package3> |
505 | + |
506 | +`pkd` MH,<repo> |
507 | + |
508 | +`pkd` L,<gitlab username>/<repo> |
509 | + |
510 | +`pkd` H,<github username>/<repo> |
511 | + |
512 | + |
513 | +## List Formattiing |
514 | + |
515 | +Do not enter any spaces between package names, between package source and package name (the comma). |
516 | + |
517 | + |
518 | +**The following list is provided below for reference:** |
519 | +--- |
520 | + |
521 | +Local or AUR Packages : 'packageName,"Comment here (optional)"' # This is most likely to be the most commonly used format. |
522 | + |
523 | +GitHub Repositories : 'H,Creator/HubRepoName,"Comment here (optional)"' |
524 | + |
525 | +GitLab Repositories : 'L,Creator/LabRepoName,"Comment here (optional)"' |
526 | + |
527 | +Personal GitHub : 'PH,yourGitHubRepoName,"Comment here (optional)"' |
528 | + |
529 | +Personal GitLab : 'PL,yourGitLabRepoName,"Comment here (optional)"' |
530 | + |
531 | +Snap Packages : 'S,snapPackageName,"Comment here (optional)"' |
532 | + |
533 | +Python Pip Packages : 'P,pythonPackageName,"Comment here (optional)"' |
534 | + |
535 | +NPM or Nodejs Packages : 'N,packageName,"Comment here (optional)"' |
536 | + |
537 | +Web files or Torrents : 'W,URL,"Comment here (optional)" |
538 | + |
539 | + |
540 | +## List Formatting Examples: |
541 | +[41m |
542 | +packages=( |
543 | + |
544 | +zsh,"A very advanced and programmable command interpreter (shell) for UNIX" |
545 | +H,neovim/neovim |
546 | +P,pipenv,"A comment is not necessary and purely meant as eye candy if saving the script for later use" |
547 | +L,a4to/nu1ll1nux |
548 | +S,snap-store |
549 | +N,lite-server |
550 | + |
551 | + ) |
552 | + |