-
Notifications
You must be signed in to change notification settings - Fork 0
/
mirall
executable file
·190 lines (165 loc) · 6.1 KB
/
mirall
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash
PROGNAME="Mirrorscript by Lars Horst"
VER='0.0.1'
_temp="/tmp/answer.test"
>$_temp
# We have to look if there's a configfile present
MIRCONF=debmirror.conf
configask () {
if [ -f $MIRCONF ]; then
dialog --backtitle "$PROGNAME $VER" \
--yesno "Do you want to use your old config" 0 0
answer=$?
else
touch debmirror.conf
fi
if [ $answer = 1 ]; then
dialog --backtitle "$PROGNAME $VER" \
--yesno "Are you sure to clear the configuration-file?" 0 0
answer2=$?
fi
}
debname () {
dialog --backtitle "$PROGNAME $VER" \
--colors --title "\Zb\ZuDEBIAN" \
--checklist "What do you want to mirror" 0 0 0 \
stretch "Stable release" on \
stretch-updates "Stable release updates" off \
stretch-backports "Stable release backports" off \
stretch-proposed-updates "Stable release proposed-updates" off \
buster "Testing release" off \
buster-updates "Testing release updates" off \
buster-backports "Testing release backports" off \
buster-proposed-updates "Testing release proposed-updates" off \
jessie "Oldstable -LTS-" off \
jessie-updates "Oldstable -LTS- updates" off \
jessie-backports "Oldstable -LTS- backports" off \
jessie-proposed-updates "Oldstable -LTS- proposed-updates" off \
Sid "unstable" off 2>$_temp
sed -i s'#"##g ; s# #,#g ; s/\([A-Z]\)/\L\1/g' $_temp
debversion=`cat $_temp`
#>$MIRCONF
#echo "#!/bin/bash">$MIRCONF
#echo "DIST=$debversion">>$MIRCONF
dialog --colors --backtitle "$PROGNAME $VER" \
--title "\Zb\Zu\Z1DEBIAN" \
--checklist "Which architecture do you want to mirror?" 0 0 0 \
amd64 "\Zb\Zu64-bit AMD/INTEL Processoren *" on \
arm64 "64-bit ARM CPU" off \
armel "older 32-bit ARM CPUs" off \
armhf "older 32-bit ARM CPU with FPU" off \
hurd-i386 "for MACH Micro Kernel" off \
i386 "\Zb\Zu32-bit AMD/INTEL Processor *" off \
ia64 "64-bit Itanium Processor" off \
kfreebsd-amd64 "64-bit based Kfreebsd-kernel" off \
kfreebsd-i386 "32-bit based Kfreebsd-kernel" off \
mips "32-bit big endian CPU" off \
mips64el "64-bit litte endian CPU" off \
mipsel "32-bit little endian CPU" off \
powerpc "Motorola RISC Processor" off \
ppc64el "IBM PowerPC CPU" off \
s390 "IBM Enterprise CPU" off \
s390x "IBM Enterprise CPU" off \
sparc "Sparc Microprocessor" off 2>$_temp
sed -i s'#"##g ; s# #,#g' $_temp
arch=`cat $_temp`
}
configbuild () {
dialog --backtitle "$PROGNAME $VER" \
--checklist "Which Distribution do you want to mirror?" 0 0 0 \
Debian "http://www.debian.org" on \
Ubuntu "http://www.ubuntu.com" off \
Antix "http://antixlinux.com" off \
MXlinux "http://mxlinux.org" off \
LMDE "http://linuxmint.com" off 2>$_temp
distro=`cat $_temp`
if [[ $distro == *"Debian"* ]]; then
debname
fi
}
configbuild
# Let's ask some question, what the user want to do
#echo "First let's look if all requirements are meet"
#DEBMIRROR=`type -p debmirror`
#if [ ! -f "$DEBMIRROR" ]; then
# echo"--error Debmirror missing,please install it (eg. sudo apt install debmirror)"
# exit 0
#fi
#echo "Debmirror ok!"
#GNUPG=`type -p gpg`
#if [ ! -f "$GNUPG" ]; then
# echo"--error GnuPG missing, please install it (eg. sudo apt install gnupg)"
# exit 0
#fi
#echo "GnuPG ok!"
#
#read -p "Where do you want to store the configfile?"$CONFIG
#touch $CONFIG/mirconf
#
## Let's define some variables. You have to edit it for your environment.
## DEBMLOG defines the path where your logfiles should be stored.
#DEBMLOG=/mnt/disk/volume1/logs/debmirror.log
## MIRRORDIR defines the path where your mirror shall be stored.
#MIRRORDIR=/mnt/disk/volume1/myweb/mirror
## HOSTDEB Debian Mirror used for mirroring.
## Please look at https://www.debian.org/mirror/list-full for mirrors and their
## offers. (eq. rsync,http,ftp...)
## and their mirrored architectures (eq. i386,arm,amd64....)
#HOSTDEB=debian.inf.tu-dresden.de
##DISTDEB Debian releases you want to mirror
#DISTDEB=stretch,buster,sid,stretch-updates,buster-updates
##ARCH Select the architectures you want to mirror eq. amd64,arm,i386,sparc,.....
#ARCH=amd64,i386
# #We need a user for running debmirror as non root. Please add this user
# and give him a homedirectory. The homedirectory should be the same as
# the MIRRORDIR. You later need it for adding gpg signatures.If you
# want a working mirror
#USER=mirror
#if test -s $DEBMLOG
#then
#test -f $DEBMLOG.3.xz && mv $DEBMLOG.3.xz $DEBMLOG.4.xz
#test -f $DEBMLOG.2.xz && mv $DEBMLOG.2.xz $DEBMLOG.3.xz
#test -f $DEBMLOG.1.xz && mv $DEBMLOG.1.xz $DEBMLOG.2.xz
#test -f $DEBMLOG.0 && mv $DEBMLOG.0 $DEBMLOG.1 && xz $DEBMLOG.1
#mv $DEBMLOG $DEBMLOG.0
#cp /dev/null $DEBMLOG
#chmod 666 $DEBMLOG
#fi
#echo "!!!!!!!!!UPDATE ALLER MIRRORS!!!!!!!!!!" 2>&1 | tee -a $DEBMLOG
#echo "---------------------------------------" 2>&1 | tee -a $DEBMLOG
#echo "######### 1. Debian Security ##########" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirupdates
#echo "######### 2. Linux Mint ###############" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirmint
#echo "######### 3. Debian Lenny #############" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirror
#echo "######### 4. VirtualBox ###############" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirvirt
#echo "######### 5. Spotify ##################" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirspotify
#echo "######### 6. MXLinux ##################" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirmx
#echo "######### 7. AntiX ####################" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirantix
#echo "######### 8. Debian ###################" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirstretch
#echo "######### 9. UBUNTU ###################" 2>&1 | tee -a $DEBMLOG
#date 2>&1 | tee -a $DEBMLOG
#/etc/mirdisco
#echo "######## Calculate MIRROR SIZE ########" 2>&1 | tee -a $DEBMLOG
#MIRSIZE=$(du -hs $MIRRORDIR)
#NOW=$(date)
#echo "$MIRSIZE" 2>&1 | tee -a $DEBMLOG
#echo "Run: $NOW" 2>&1 | tee -a $DEBMLOG
#echo "!!!!!!!!!!END MIRROR UPDATE!!!!!!!!!!!!" 2>&1 | tee -a $DEBMLOG
#echo "#######################################" 2>&1 | tee -a $DEBMLOG
#/etc/init.d/noflushd stop
#noflushd -n 20 /dev/sda /dev/sdb