/[smecontribs]/rpms/smeserver-migratehelper/contribs10/migratehelper.sh
ViewVC logotype

Annotation of /rpms/smeserver-migratehelper/contribs10/migratehelper.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.12 - (hide annotations) (download) (as text)
Tue Mar 7 04:38:34 2023 UTC (20 months, 2 weeks ago) by jpp
Branch: MAIN
Changes since 1.11: +9 -0 lines
Content type: application/x-sh
* Thu Dec 02 2021 Jean-Philippe Pialasse <tests@pialasse.com> 1.0-10.sme
- remove non existing standard path /home/e-smith/home

1 jpp 1.1 #!/bin/bash
2    
3 jcrisp 1.6 echo "#*************************************************************************# "
4     echo "# Note we are NOT including >>"
5     echo "# /home/e-smith/{files,shares} "
6     echo "# /home/e-smith/db/mysql*/{daily,hourly}"
7     echo "# "
8     echo "# You are responsible for backing up and restoring them separately"
9     echo "#*************************************************************************# "
10    
11     TEST="n" # Set Test mode default
12     VERSION=1 # Just because
13     NOCHECK="0"
14    
15     # ===========================================================================
16    
17     function usage() { # Function: Print a help message.
18     echo "Usage: $0 [ -t Enable Test mode ] [ -n no-check ] [ -v Version ] [ -h Help ]" 1>&2
19     }
20    
21     function exit_abnormal() { # Function: Exit with error.
22     usage
23     exit 1
24     }
25    
26     function prompt_confirm() {
27     while true; do
28     read -r -n 1 -p "${1:-Continue?} [y/n]: " REPLY
29     case $REPLY in
30     [yY])
31     echo
32     return 0
33     ;;
34     [nN])
35     echo
36     return 1
37     ;;
38     *) printf " \033[31m %s \n\033[0m" "invalid input" ;;
39     esac
40     done
41     }
42    
43     while getopts ":vthn" options; do # Loop: Get the next option;
44     # use silent error checking;
45     # options have no arguments
46     case "${options}" in #
47     v) # If the option is n,
48     echo "Version $VERSION"
49     exit_abnormal
50     ;;
51     t) # If the option is t,
52     TEST="y" # Set $TEST
53     ;;
54     n)
55     echo "Checking"
56     NOCHECK="1"
57     ;;
58     h)
59     exit_abnormal
60     ;;
61    
62     \?) # If unknown (any other) option:
63     echo "invalid_option"
64     exit_abnormal # Exit abnormally.
65     ;;
66    
67     *) # If unknown (any other) option:
68     echo "unknown_option"
69     exit_abnormal # Exit abnormally.
70     ;;
71    
72     # Me hacking about
73     # :) # If expected argument omitted:
74     # echo "Error: -${OPTARG} requires an argument."
75     # exit_abnormal # Exit abnormally.
76     # ;;
77    
78     esac
79    
80     done
81    
82     if [ "$NOCHECK" = "0" ]; then
83     prompt_confirm "Can we start?" || exit 0
84     fi
85    
86     # Let's go.
87     echo "Starting - please be patient"
88    
89     if [ "$TEST" = "y" ]; then
90     echo "We are in TEST mode. No backup will be created or services affected"
91     else
92     echo "We are in REAL mode."
93     echo "This creates a backup file for restore"
94     echo "The file includes and excludes various items"
95     echo "All files, mails and MySQL DBS are not included"
96     echo "We will create the backup file like this"
97     echo "tar cvzf /mnt/backup/smeserver.tgz -T dir.list --exclude-from exclude.list"
98     echo ""
99     echo "After the script has finished all mail/file.web services will be stopped"
100     echo "Copy the backup to your new server, and manually copy over the remaining files"
101     fi
102    
103     # Added failure check
104     # https://github.com/koalaman/shellcheck/wiki/SC2164
105    
106     cd /root || exit_abnormal
107    
108     cat <<'EOF' >dir.list
109 jpp 1.1 /etc/e-smith/templates-custom
110     /etc/e-smith/templates-user-custom
111     /etc/group
112     /etc/gshadow
113     /etc/passwd
114     /etc/samba/secrets.tdb
115     /etc/samba/smbpasswd
116     /etc/shadow
117     /etc/ssh
118     /etc/sudoers
119     /root
120     /home/e-smith/Maildir
121     /home/e-smith/ssl.crt
122     /home/e-smith/ssl.key
123     /home/e-smith/dkim_keys
124     /home/e-smith/db
125     /var/lib/dhcpd/dhcpd.leases
126     /var/log/qpsmtpd
127     /var/log/sqpsmtpd
128     /var/log/qmail
129     /var/log/httpd/
130     /var/log/dovecot/
131     /var/log/squid/
132     /var/log/iptables/
133     /var/spool/mail/
134     /var/spool/spamd/
135 jpp 1.5 /var/spool/cron/
136 jpp 1.1 EOF
137    
138 jcrisp 1.6 [ -e /etc/smbpasswd ] && cat <<'EOF' >>dir.list
139 jpp 1.3 /etc/smbpasswd
140     EOF
141    
142 jcrisp 1.6 [ -e /var/log/samba/samba_audit ] && cat <<'EOF' >>dir.list
143 jpp 1.1 /var/log/samba/samba_audit
144     EOF
145    
146 jcrisp 1.6 [ -e /etc/samba/schannel_store.tdb ] && cat <<'EOF' >>dir.list
147 jpp 1.5 /etc/samba/schannel_store.tdb
148     EOF
149    
150 jcrisp 1.6 [ -e /var/lib/samba/group_mapping.tdb ] && cat <<'EOF' >>dir.list
151 jpp 1.5 /var/lib/samba/group_mapping.tdb
152     EOF
153    
154 jcrisp 1.6 [ -e /var/lib/samba/account_policy.tdb ] && cat <<'EOF' >>dir.list
155 jpp 1.5 /var/lib/samba/account_policy.tdb
156     EOF
157    
158 jcrisp 1.6 [ -e /var/log/samba/samba_audit ] && cat <<'EOF' >>dir.list
159 jpp 1.5 /var/log/samba/samba_audit
160     EOF
161    
162 jcrisp 1.6 [ -e /var/service/qpsmtpd/config/dkimkeys/ ] && cat <<'EOF' >>dir.list
163 jpp 1.1 /var/service/qpsmtpd/config/dkimkeys/
164     EOF
165    
166     ## add here inclusion from db key
167    
168     ## exclude files
169     cat <<EOF >exclude.list
170     /home/e-smith/db/mysql/daily
171     /home/e-smith/db/mysql/hourly
172     /home/e-smith/db/mysql55/daily
173     /home/e-smith/db/mysql55/hourly
174     /home/e-smith/db/mysql57/daily
175     /home/e-smith/db/mysql57/hourly
176     /home/e-smith/files
177     /home/e-smith/shares
178     /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModule80PHP
179     /etc/e-smith/templates-custom/etc/hosts.allow/sshd
180     /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/35SSL00Listen443
181     /etc/e-smith/templates-custom/etc/dhcpd.conf/25DomainNameServers
182     /etc/e-smith/templates-custom/etc/dhcpd.conf/25LeaseTimeDefault
183     /etc/e-smith/templates-custom/etc/dhcpd.conf/25LeaseTimeMax
184     /etc/e-smith/templates-custom/etc/dhcpd.conf/25Routers
185     EOF
186    
187     ## add here exclusion from db key
188 jcrisp 1.6 # Added -print0 here - also needs -0 on xargs
189     # https://github.com/koalaman/shellcheck/wiki/SC2038
190     # search for local script added
191     find /usr/local/bin/ -type f -print0 | xargs -0 -I % sh -c "rpm -qf % 2>&1 > /dev/null || echo % >> dir.list"
192 jpp 1.2 # search for local dir script added
193 jcrisp 1.6 find /usr/local/ -maxdepth 1 -type d -print0 | xargs -0 -I % sh -c "rpm -qf % 2>&1 > /dev/null || echo % >> dir.list"
194     # search for cron files not owned by a rpm
195     find /etc/cron.* -type f -print0 | xargs -0 -I % sh -c "rpm -qf % 2>&1 > /dev/null || echo % >> dir.list"
196 jpp 1.1 # search for udev rules not owned by a rpm ! oucl add an option there in case you change of hardware
197 jcrisp 1.6 find /etc/udev/rules.d/ -type f -print0 | xargs -0 -I % sh -c "rpm -qf % 2>&1 > /dev/null || echo % >> dir.list"
198 jpp 1.2 # search for spamassassin user created config
199 jcrisp 1.6 find /etc/mail/spamassassin -maxdepth 1 -type f -print0 | xargs -0 -I % sh -c "rpm -qf % 2>&1 > /dev/null || echo % >> dir.list"
200 jpp 1.1
201     ##################
202     #
203     # here starts the magic
204 jcrisp 1.6 # we backup each known contribs folder
205 jpp 1.1 #
206     ##################
207 jcrisp 1.6 #smeserver-awstats.noarch
208 jpp 1.1 # data will be in /home/e-smith/files/users/admin
209     # we only backup the config files
210 jcrisp 1.6 rpm -q smeserver-awstats >/dev/null 2>&1 && cat <<'EOF' >>dir.list
211 jpp 1.1 /etc/e-smith/web/panels/manager/cgi-bin/.awstats/
212     EOF
213 jcrisp 1.6 # see with Daniel if they have a specific config
214 jpp 1.1 #rpm -q awstats >/dev/null 2>&1 && cat <<'EOF' >> dir.list
215     #/var/lib/awstats
216     #EOF
217     #for those we assume you handle yourself the backup or the pools in /var/lib/BackupPC
218 jcrisp 1.6 rpm -q smeserver-BackupPC >/dev/null 2>&1 && cat <<'EOF' >>dir.list
219 jpp 1.1 /etc/BackupPC
220     EOF
221 jcrisp 1.6 rpm -q smeserver-BackupPC4 >/dev/null 2>&1 && cat <<'EOF' >>dir.list
222 jpp 1.1 /etc/BackupPC
223     EOF
224 jcrisp 1.6 rpm -q smeserver-bandwidthd >/dev/null 2>&1 && cat <<'EOF' >>dir.list
225 jpp 1.1 /var/www/bandwidthd/
226     EOF
227     #smeserver-clamav-unofficial-sigs and clamav-unofficial-sigs
228 jcrisp 1.6 rpm -q smeserver-clamav-unofficial-sigs >/dev/null 2>&1 && cat <<'EOF' >>dir.list
229 jpp 1.1 /var/lib/clamav-unofficial-sigs/
230     EOF
231     #smeserver-dansguardian smeserver-dansguardian-panel
232 jcrisp 1.6 rpm -q smeserver-dansguardian >/dev/null 2>&1 && cat <<'EOF' >>dir.list
233 jpp 1.1 /etc/dansguardian/
234     EOF
235     #smeserver-denyhosts
236 jcrisp 1.6 rpm -q smeserver-denyhosts >/dev/null 2>&1 && cat <<'EOF' >>dir.list
237 jpp 1.1 /var/lib/denyhosts/
238     /etc/hosts.deny_ssh
239     /etc/hosts.deny_ssh.purge.bak
240     EOF
241 jcrisp 1.6 rpm -q smeserver-dl >/dev/null 2>&1 && cat <<'EOF' >>dir.list
242 jpp 1.1 /var/lib/dl/
243     EOF
244 jcrisp 1.6 rpm -q dokuwiki >/dev/null 2>&1 && cat <<'EOF' >>dir.list
245 jpp 1.1 /etc/dokuwiki/acl.auth.php
246     /etc/dokuwiki/acronyms.conf
247     /etc/dokuwiki/entities.conf
248     /etc/dokuwiki/interwiki.conf
249     /etc/dokuwiki/local.php
250     /etc/dokuwiki/plugins.local.php
251     /etc/dokuwiki/scheme.conf
252     /var/lib/dokuwiki/data/attic
253     /var/lib/dokuwiki/data/index
254     /var/lib/dokuwiki/data/media
255     /var/lib/dokuwiki/data/media_attic
256     /var/lib/dokuwiki/data/media_meta
257     /var/lib/dokuwiki/data/meta
258     /var/lib/dokuwiki/data/pages
259     EOF
260 jcrisp 1.6 rpm -q dokuwiki >/dev/null 2>&1 && for D in /usr/share/dokuwiki/lib/plugins/*; do
261     rpm -qf "$D" >/dev/null 2>&1 || echo "$D" >>dir.list
262 jpp 1.1 done
263    
264 jpp 1.3 #rpm -q smeserver-dovecot >/dev/null 2>&1 && cat <<'EOF' >> dir.list
265 jcrisp 1.6 [ -e /etc/dovecot/sharemailbox ] && cat <<'EOF' >>dir.list
266 jpp 1.1 /etc/dovecot/sharemailbox/
267     EOF
268    
269     #smeserver-durep
270 jcrisp 1.6 rpm -q smeserver-durep >/dev/null 2>&1 && cat <<'EOF' >>dir.list
271 jpp 1.1 /var/lib/durep
272     EOF
273     #smeserver-ezmlm-web
274 jcrisp 1.6 rpm -q smeserver-ezmlm-web >/dev/null 2>&1 && cat <<'EOF' >>dir.list
275 jpp 1.1 /home/e-smith/files/ezmlm
276     EOF
277 jcrisp 1.6 [ -e /var/lib/phone ] && cat <<'EOF' >>dir.list
278 jpp 1.1 /var/lib/phone
279     EOF
280 jcrisp 1.6 rpm -q smeserver-freepbx >/dev/null 2>&1 && cat <<'EOF' >>dir.list
281 jpp 1.1 /opt/freepbx
282     /var/lib/asterisk/
283     /etc/asterisk
284     /var/spool/asterisk/
285     /var/log/asterisk
286     /usr/local/sbin/amportal
287     /usr/local/sbin/fwconsole
288     /usr/sbin/amportal
289     /usr/sbin/fwconsole
290     EOF
291 jcrisp 1.8 # smeserver-fail2ban
292 jpp 1.1 if [ -d /etc/fail2ban/action.d ]; then
293 jcrisp 1.8 for F in $(ls /etc/fail2ban/action.d/);do
294     rpm -qf /etc/fail2ban/action.d/$F >/dev/null 2>&1 || echo /etc/fail2ban/action.d/$F >> dir.list
295 jpp 1.1 done
296     fi
297     if [ -d /etc/fail2ban/fail2ban.d ]; then
298 jcrisp 1.8 for F in $(ls /etc/fail2ban/fail2ban.d/);do
299     rpm -qf /etc/fail2ban/fail2ban.d/$F >/dev/null 2>&1 || echo /etc/fail2ban/fail2ban.d/$F >> dir.list
300 jpp 1.1 done
301     fi
302     if [ -d /etc/fail2ban/filter.d ]; then
303 jcrisp 1.8 for F in $(ls /etc/fail2ban/filter.d/);do
304     rpm -qf /etc/fail2ban/filter.d/$F >/dev/null 2>&1 || echo /etc/fail2ban/filter.d/$F >> dir.list
305 jpp 1.1 done
306     fi
307     if [ -d /etc/fail2ban/jail.d ]; then
308 jcrisp 1.9 for F in $(ls /etc/fail2ban/jail.d/);do
309 jcrisp 1.8 rpm -qf /etc/fail2ban/jail.d/$F >/dev/null 2>&1 || echo /etc/fail2ban/jail.d/$F >> dir.list
310 jpp 1.1 done
311     fi
312 jcrisp 1.6 rpm -q smeserver-grr >/dev/null 2>&1 && cat <<'EOF' >>dir.list
313 jpp 1.1 /usr/share/grr/images/
314     EOF
315 jcrisp 1.6 rpm -q ipasserelle-im >/dev/null 2>&1 && cat <<'EOF' >>dir.list
316 jpp 1.1 /var/lib/ejabberd/
317     /var/log/ejabberd.run
318     EOF
319     #smeserver-isoqlog
320 jcrisp 1.6 rpm -q smeserver-isoqlog >/dev/null 2>&1 && cat <<'EOF' >>dir.list
321 jpp 1.1 /var/lib/qmailtools/isoqlog/htdocs/
322     EOF
323 jcrisp 1.6 rpm -q smeserver-jappix >/dev/null 2>&1 && cat <<'EOF' >>dir.list
324 jpp 1.1 /var/lib/jappix/
325     /var/log/jappix
326     EOF
327 jcrisp 1.6 rpm -q smeserver-lemonldap-ng >/dev/null 2>&1 && cat <<'EOF' >>dir.list
328 jpp 1.1 /var/lib/lemonldap-ng/conf
329     /var/lib/lemonldap-ng/notifications
330     EOF
331     #smeserver-letsencrypt
332 jpp 1.3 #rpm -q smeserver-letsencrypt >/dev/null 2>&1 && cat <<'EOF' >> dir.list
333 jcrisp 1.6 [ -d /etc/letsencrypt.sh/ ] && cat <<'EOF' >>dir.list
334 jpp 1.1 /etc/letsencrypt.sh/
335 jpp 1.3 EOF
336 jcrisp 1.6 [ -d /etc/dehydrated/ ] && cat <<'EOF' >>dir.list
337 jpp 1.1 /etc/dehydrated/
338     EOF
339 jpp 1.3
340 jcrisp 1.6 rpm -q smeserver-limesurvey >/dev/null 2>&1 && cat <<'EOF' >>dir.list
341 jpp 1.1 /var/lib/limesurvey/uploads
342     EOF
343 jcrisp 1.6 rpm -q ipasserelle-listes >/dev/null 2>&1 && cat <<'EOF' >>dir.list
344 jpp 1.1 /var/lib/mailman/
345     /usr/lib/mailman/aliases/
346     EOF
347     if [ -d /usr/share/mozilla-mcd/ ]; then
348 jcrisp 1.6 for F in /usr/share/mozilla-mcd/*; do
349     rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
350 jpp 1.1 done
351     fi
352 jcrisp 1.6 rpm -q smeserver-madsonic >/dev/null 2>&1 && cat <<'EOF' >>dir.list
353 jpp 1.1 /var/madsonic/db/
354     /var/madsonic/madsonic.properties
355     /var/madsonic/madsonic.log
356     /var/madsonic/madsonic_sh.log
357     EOF
358 jcrisp 1.6 rpm -q smeserver-mailman >/dev/null 2>&1 && cat <<'EOF' >>dir.list
359 jpp 1.1 /var/lib/mailman/
360     /usr/lib/mailman/aliases/
361     EOF
362 jcrisp 1.6 rpm -q smeserver-nextcloud >/dev/null 2>&1 && cat <<'EOF' >>dir.list
363 jpp 1.1 /usr/share/nextcloud/
364     EOF
365 jcrisp 1.6 rpm -q smeserver-ntop >/dev/null 2>&1 && cat <<'EOF' >>dir.list
366 jpp 1.1 /var/lib/ntop/
367     EOF
368 jcrisp 1.6 rpm -q phpki >/dev/null 2>&1 && cat <<'EOF' >>dir.list
369 jpp 1.1 /opt/phpki/phpki-store/
370     /opt/phpki/html/config.php
371     EOF
372 jcrisp 1.6 rpm -q smeserver-openvpn-bridge >/dev/null 2>&1 && cat <<'EOF' >>dir.list
373 jpp 1.1 /etc/openvpn/bridge/priv
374     /etc/openvpn/bridge/pub
375     /var/log/openvpn-bridge
376     EOF
377 jcrisp 1.6 rpm -q smeserver-openvpn-s2s >/dev/null 2>&1 && cat <<'EOF' >>dir.list
378 jpp 1.1 /etc/openvpn/s2s/priv
379     /etc/openvpn/s2s/pub
380     /var/log/openvpn-s2s
381     EOF
382 jcrisp 1.6 rpm -q smeserver-openvpn-routed >/dev/null 2>&1 && cat <<'EOF' >>dir.list
383 jpp 1.1 /etc/openvpn/routed/priv
384     /etc/openvpn/routed/pub
385     /var/log/openvpn-routed
386     EOF
387 jcrisp 1.6 rpm -q smeserver-phpki >/dev/null 2>&1 && cat <<'EOF' >>dir.list
388 jpp 1.1 /opt/phpki/
389     EOF
390 jcrisp 1.6 rpm -q smeserver-phpki-ng >/dev/null 2>&1 && cat <<'EOF' >>dir.list
391 jpp 1.1 /opt/phpki/
392     EOF
393 jcrisp 1.6 rpm -q pydio >/dev/null 2>&1 && cat <<'EOF' >>dir.list
394 jpp 1.1 /var/lib/pydio/files
395     /var/lib/pydio/personal
396     /var/lib/pydio/public
397     /var/log/pydio
398     EOF
399    
400 jcrisp 1.6 rpm -q smeserver-sarg >/dev/null 2>&1 && cat <<'EOF' >>dir.list
401 jpp 1.1 /var/www/sarg/
402     EOF
403     #smeserver-sme8admin
404 jcrisp 1.6 rpm -q smeserver-sme8admin >/dev/null 2>&1 && cat <<'EOF' >>dir.list
405 jpp 1.1 /var/lib/sme8admin/
406     EOF
407     #smeserver-sme9admin
408 jcrisp 1.6 rpm -q smeserver-sme9admin >/dev/null 2>&1 && cat <<'EOF' >>dir.list
409 jpp 1.1 /var/lib/sme9admin/
410     EOF
411 jpp 1.12 #softethernet
412     rpm -q softethervpn >/dev/null 2>&1 && cat <<'EOF' >>dir.list
413     /usr/vpnserver/vpn_server.config
414     /usr/vpnserver/backup.vpn_server.config
415     /usr/vpnserver/chain_certs
416     /usr/vpnserver/packet_log
417     /usr/vpnserver/security_log
418     /usr/vpnserver/server_log
419     EOF
420 jpp 1.1 #smeserver-sysmon
421 jcrisp 1.6 rpm -q smeserver-sysmon >/dev/null 2>&1 && cat <<'EOF' >>dir.list
422 jpp 1.1 /var/lib/rrd/
423     EOF
424 jcrisp 1.6 rpm -q smeserver-tftp-server >/dev/null 2>&1 && cat <<'EOF' >>dir.list
425 jpp 1.1 /tftpboot
426     EOF
427 jcrisp 1.6 rpm -q smeserver-transmission >/dev/null 2>&1 && cat <<'EOF' >>dir.list
428 jpp 1.1 /var/lib/transmission/Downloads
429     EOF
430 jcrisp 1.6 rpm -q smeserver-unifi >/dev/null 2>&1 && cat <<'EOF' >>dir.list
431 jpp 1.1 /opt/UniFi
432     /opt/UniFi_bak
433     EOF
434 jcrisp 1.6 rpm -q smeserver-xinetd >/dev/null 2>&1 && cat <<'EOF' >>dir.list
435 jpp 1.1 /etc/rsyncd.conf
436     /etc/xinetd.d/rsync
437     /etc/logrotate.d/rsyncd
438     EOF
439 jcrisp 1.6 rpm -q smeserver-xt_geoip >/dev/null 2>&1 && cat <<'EOF' >>dir.list
440 jpp 1.1 /usr/share/xt_geoip/BE/
441     /usr/share/xt_geoip/LE/
442     /var/lib/xt_geoip/
443     EOF
444 jcrisp 1.6 rpm -q smeserver-webfilter >/dev/null 2>&1 && cat <<'EOF' >>dir.list
445 jpp 1.1 /var/squidGuard/blacklists/
446     EOF
447 jpp 1.11 #smeserver-webshare
448     rpm -q smeserver-webshare >/dev/null 2>&1 && cat <<'EOF' >>dir.list
449 jpp 1.1 /opt/webshare
450     EOF
451     # smeserver-zabbix-server smeserver-zabbix-agent smeserver-zabbix-proxy
452     if [ -d /etc/zabbix ]; then
453 jcrisp 1.6 for F in /etc/zabbix/*; do
454     rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
455 jpp 1.1 done
456     fi
457     if [ -d /etc/zabbix/zabbix_agentd.conf.d ]; then
458 jcrisp 1.6 for F in /etc/zabbix/zabbix_agentd.conf.d/*; do
459     rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
460 jpp 1.1 done
461     fi
462     if [ -d /var/lib/zabbix/bin ]; then
463 jcrisp 1.6 for F in /var/lib/zabbix/bin/*; do
464     rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
465 jpp 1.1 done
466     fi
467 jcrisp 1.6 rpm -q smeserver-zoneminder >/dev/null 2>&1 && cat <<'EOF' >>dir.list
468 jpp 1.1 /var/lib/zoneminder
469     /var/log/zoneminder
470     /var/spool/zoneminder-upload
471     EOF
472    
473     #contribs we are aware of, but NOTHING TO DO
474     #smeserver-email-management
475     #smeserver-geoip
476     #smeserver-kronolith
477     #smeserver-lazy_admin_tools
478     #smeserver-learn
479     #smeserver-mailsorting
480     #smeserver-mailstats
481     #smeserver-mod_dav
482     #smeserver-nag
483     #smeserver-php-fpm
484     #smeserver-php-scl
485     #smeserver-phpldapadmin.
486     #smeserver-phpsysinfo
487     #smeserver-qmHandle
488     #smeserver-remoteuseraccess
489     #smeserver-userpanel
490     #smeserver-userpanels
491     #smeserver-vacation
492     #smeserver-wbl
493     #smeserver-webapps-common
494     #smeserver-webhosting
495     #smeserver-bridge-interface
496     #smeserver-ddclient
497     #smeserver-mediatomb
498     #smeserver-sane
499     #smeserver-usbdisksmanager
500    
501 jcrisp 1.6 # we might get issue there with .rpmnew files
502     # but we need to get the same version as in db
503 jpp 1.1
504     # for F in /usr/share/nextcloud/apps/*;do
505 jcrisp 1.6 # rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >> dir.list
506 jpp 1.1 # done
507    
508 jcrisp 1.6 /sbin/e-smith/audittools/newrpms >/root/newrpms
509     cat </root/newrpms | grep @ | cut -d' ' -f1 | sed 's/.noarch//g' | sed 's/.x86_64//g' | sed 's/.i386//g' | sort | grep smeserver >/root/contribs
510     cat </root/newrpms | grep @ | cut -d' ' -f1 | sed 's/.noarch//g' | sed 's/.x86_64//g' | sed 's/.i386//g' | sort >/root/rpmsextra
511 jpp 1.1
512 jcrisp 1.6 mkdir -p /root/migratehelper/{yumDownload,lists}
513    
514     # Filter out in file per repo
515    
516     echo "Run through all created files for /root/migratehelper/lists/RpmsPerRepos_*.list"
517     echo "and"
518     echo "yum reinstall --downloadonly --downloaddir=/root/migratehelper/yumDownload"
519     echo "maybe followed by"
520     echo "yum update --downloadonly --downloaddir=/root/migratehelper/yumDownload"
521     echo "or"
522     echo "yum install --downloadonly --downloaddir=/root/migratehelper/yumDownload --installroot=/root/migratehelper/ smeserver-yum --enablerepo=smeos,base --releasever=6"
523     echo "or after requiring yum-utils (bug it seems to only download to current dir whatever you do:"
524     echo "cd /root/migratehelper/yumDownload; yumdownloader install --downloadonly --downloaddir=. smeserver-freepbx -y --disablerepo=* --enablerepo=\$repo --releasever=6"
525    
526     if [ $TEST = "n" ]; then
527     echo "Stopping Services and running backup"
528 jcrisp 1.7
529     # uncomment to test Test and prevent backup running
530     # echo "Test mode $TEST"
531     # exit 1
532 jcrisp 1.6
533     #### stop services so no changes occurs
534     if [ -e /usr/lib/systemd/system/qmail.service ]; then
535     /usr/bin/systemctl stop qmail.service qpsmtpd.service sqpsmtpd.service ejabberd.service smb.service smbd.service nmbd.service httpd-e-smith.service
536     else
537     sv d /service/qmail
538     sv d /service/qpsmtpd
539     sv d /service/sqpsmtpd
540     [ -e /service/ejabberd ] && sv d /service/ejabberd
541     sv d /service/smbd
542     sv d /service/httpd-e-smith
543     fi
544    
545     #### prebackup
546     signal-event pre-backup
547    
548     if [ ! -d /mnt/backup ]; then
549     mkdir -p /mnt/backup
550     fi
551    
552     tar cvzf /mnt/backup/smeserver.tgz -T dir.list --exclude-from exclude.list --xattrs
553     echo "Finished. Backup file is in /mnt/backup"
554     echo "All services stopped."
555     echo "Please copy the remaining files to the new server before you halt this server"
556 jpp 1.1
557     else
558 jcrisp 1.6 echo "Test mode enabled - no backup run"
559 jcrisp 1.7 echo "Test mode $TEST"
560 jcrisp 1.6 exit 0
561     fi
562    
563     exit 0

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed