-
Notifications
You must be signed in to change notification settings - Fork 3
/
dl_alien_package_JBs.sh
executable file
·128 lines (106 loc) · 3.94 KB
/
dl_alien_package_JBs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#
# Autor= João Batista Ribeiro
# Bugs, Agradecimentos, Críticas "construtivas"
# me envie um e-mail. Ficarei Grato!
# e-mail: joao42lbatista@gmail.com
#
# Este programa é um software livre; você pode redistribui-lo e/ou
# modifica-lo dentro dos termos da Licença Pública Geral GNU como
# publicada pela Fundação do Software Livre (FSF); na versão 2 da
# Licença, ou (na sua opinião) qualquer versão.
#
# Este programa é distribuído na esperança que possa ser útil,
# mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a
# qualquer MERCADO ou APLICAÇÃO EM PARTICULAR.
#
# Veja a Licença Pública Geral GNU para mais detalhes.
# Você deve ter recebido uma cópia da Licença Pública Geral GNU
# junto com este programa, se não, escreva para a Fundação do Software
#
# Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script: Download files/packages from one mirror with CHECKSUMS.md5
#
# Last update: 19/06/2023
#
case "$(uname -m)" in
i?86) archDL="x86" ;;
*) archDL=$(uname -m) ;;
esac
echo -e "\n# This script download files/packages from one Alien mirror #\n"
pathDl=$1 # Use the "pathDl" to download the packages instead the (full) folder
#mirrorStart="http://www.slackware.com/~alien/sbrepos"
#mirrorStart="https://slackware.nl/people/alien/sbrepos"
mirrorStart="https://slackware.uk/people/alien/sbrepos"
echo "Default mirror: $mirrorStart"
echo -en "\nWant change the mirror?\n(y)es - (n)o (press enter to no): "
read -r changeMirror
if [ "$changeMirror" == 'y' ]; then
mirrorStart=''
while echo "$mirrorStart" | grep -v -q -E "ftp|http"; do
echo -en "\nType the new mirror: "
read -r mirrorStart
if echo "$mirrorStart" | grep -v -q -E "ftp|http"; then
echo -e "\nError: the mirror \"$mirrorStart\" is not valid\nOne valid mirror has \"ftp\" or \"http\""
fi
done
echo -e "\nNew mirror: $mirrorStart"
fi
echo -en "\nWith version Slackware you want? (press enter to 15.0): "
read -r versionSlackware
if [ "$versionSlackware" == '' ]; then
versionSlackware="15.0"
fi
if [ "$pathDl" == '' ]; then
echo -en "\nType the path/program that want download: "
read -r pathDl
fi
echo -en "\nOnly \"t?z\" or all files?\n1 to only \"t?z\" - 2 to all (hit enter to only t?z): "
read -r allOrNot
if [ "$allOrNot" != 2 ]; then
extensionFile=".t\\?z"
fi
mirrorDl="$mirrorStart/$versionSlackware/$archDL"
echo
wget "$mirrorDl/CHECKSUMS.md5" -O CHECKSUMS.md5
runFileTmp=$(grep "$pathDl.*.$extensionFile$" < CHECKSUMS.md5)
rm CHECKSUMS.md5
runFile=$(echo "$runFileTmp" | cut -d '/' -f2-)
echo -e "All packages found with \"$pathDl\":\n$runFile"
echo -e "\nExclude some results based in some patterns?"
echo -n "Hit enter to no or type the patterns (use | between the patterns, like: p1|p2): "
read -r pathExclude
if [ "$pathExclude" != '' ]; then
echo -e "\nFiles excluded with \"$pathExclude\":"
echo "$runFile" | grep -E "$pathExclude"
runFileTmp=$(echo "$runFileTmp" | grep -vE "$pathExclude")
runFile=$(echo "$runFile" | grep -vE "$pathExclude")
fi
if [ "$runFile" != '' ]; then
echo -e "\nCurrent packages found with \"$pathDl\":\n$runFile\n"
echo -n "Want to continue and download them or no to only show the links? (y)es - (n)o (hit enter to yes): "
read -r continueDl
if [ "$continueDl" != 'n' ]; then
folderName="${pathDl}_new"
mkdir "$folderName"
cd "$folderName" || exit
for fileGrep in $(echo -e "$runFile"); do
echo
wget -c "$mirrorDl/$fileGrep"
wget -c "$mirrorDl/$fileGrep.md5"
done
echo -e "Md5sum test of integrate:"
md5sum -c ./*.md5
else
for fileGrep in $(echo -e "$runFile"); do
echo
echo "$mirrorDl/$fileGrep"
echo "$mirrorDl/$fileGrep.md5"
done
echo -e "\nJust exiting by user choice"
fi
else
echo -e "\nNot found any file to download"
fi
echo