forked from centminmod/centminmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcentminmod_packager.sh
executable file
·60 lines (50 loc) · 1.31 KB
/
centminmod_packager.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
#!/bin/bash
################################################
# package up the Centmin Mod required downloads
# from /svr-setup into a zip package you can
# reuse locally for new installs without having
# to redownload the entire info
################################################
DT=$(date +"%d%m%y-%H%M%S")
PKGBASE='/home'
PKGDIR="${PKGBASE}/centminmod_pkg"
PKGNAME='centminmod_pkg'
################################################
# set locale temporarily to english
# due to some non-english locale issues
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
shopt -s expand_aliases
for g in "" e f; do
alias ${g}grep="LC_ALL=C ${g}grep" # speed-up grep, egrep, fgrep
done
mkdir -p $PKGDIR
cd /svr-setup
for f in $(ls /svr-setup)
do
if [[ "$(stat --printf='%F' $f)" != 'directory' ]]; then
echo "copying $f to $PKGDIR"
\cp -f $f $PKGDIR
fi
done
echo
echo "copy ngx_pagespeed + psol"
cd /svr-setup
\cp -a $(ls -t | grep ngx_pagespeed-release | head -n1) $PKGDIR
echo
du -sh $PKGDIR
ls -lah $PKGDIR
echo
echo "zip up package directory $PKGDIR"
cd $PKGBASE
time zip -4 -q -r ${PKGNAME}-$DT ${PKGNAME}
echo
ls -lah $PKGBASE | grep $PKGNAME
# clean up
rm -rf $PKGDIR
echo
echo "packaging completed"
echo "saved package to ${PKGBASE}/${PKGNAME}-${DT}.zip"
exit