-
Notifications
You must be signed in to change notification settings - Fork 0
/
strip-sf-to-minimal-runtime.sh
executable file
·57 lines (50 loc) · 1.73 KB
/
strip-sf-to-minimal-runtime.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
#!/bin/sh
. /etc/farmconfig
. /opt/farm/scripts/functions.custom
backup="`local_backup_directory`/custom/farm-strip-backup.tgz"
if [ ! -f $backup ]; then
tar czf $backup /opt/farm 2>/dev/null
fi
rm -f /opt/farm/* 2>/dev/null
rm -f /opt/farm/.* 2>/dev/null
rm -rf /opt/farm/.git \
/opt/farm/scripts/config \
/opt/farm/scripts/setup
rm -f /opt/farm/scripts/init \
/opt/farm/scripts/functions.dialog \
/opt/farm/scripts/functions.install \
/opt/farm/scripts/functions.keys \
/opt/farm/scripts/functions.uid \
/opt/farm/scripts/git/key.sh \
/opt/farm/ext/.gitignore
sed -i -e "s/^#.*//" /opt/farm/scripts/functions.custom
for EXT in `ls -1 /opt/farm/ext/`; do
EP=/opt/farm/ext/$EXT
rm -rf $EP/.git
rm -f $EP/LICENSE $EP/README.md $EP/setup.sh $EP/uninstall.sh
if [ "$EXT" = "ip-fw" ]; then
rm -rf $EP/config $EP/service
elif [ "$EXT" = "firewall" ]; then
rm -rf $EP/generator
elif [ "$EXT" = "keys" ]; then
rm -rf $EP/gpg
elif [ "$EXT" = "monitoring-space" ]; then
rm -rf $EP/config $EP/discover-directories.sh
elif [ "$EXT" = "backup" ]; then
rm -f $EP/cron/push-to-collector.sh
elif [ "$EXT" = "app-deploy" ]; then
rm -rf $EP/app-install.sh
elif [ "$EXT" = "thermal-utils" ]; then
rm -rf $EP/support
elif [ ! -d $EP/cron ] && [ "$EXT" != "ip-allocs" ] && [ "$EXT" != "packages" ] && [ "$EXT" != "db-utils" ] && [ "$EXT" != "net-utils" ] && [ "$EXT" != "storage-utils" ] && [ "$EXT" != "sms-smsapi" ]; then
rm -rf $EP
fi
done
if [ -f /etc/ec2_version ] && [ -f /etc/cloud/build.info ]; then
for SUB in `ls /opt/farm/ext/firewall/hosts/ |grep -v $HOST`; do
rm -rf /opt/farm/ext/firewall/hosts/$SUB
done
if [ -d /opt/farm/ext/firewall/links ]; then
find -L /opt/farm/ext/firewall/links -maxdepth 1 -type l -delete
fi
fi