Skip to content

Commit 09d4776

Browse files
author
Yuchen Deng
committed
只卸载一次不必要组件
1 parent d5071b0 commit 09d4776

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

base-config.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ for i in {1000..1005}; do
104104
done
105105
# No password for sudo
106106
/bin/sed -i "s/.*sudo.*ALL=(ALL:ALL) ALL/%sudo ALL=(ALL) NOPASSWD:ALL/" /etc/sudoers
107+
# 移除奇怪的软链接
108+
[ -L /bin/X11 ] && /bin/unlink /bin/X11
107109
EOF
108110

109111
chroot $ROOT /bin/bash /config.sh
@@ -115,17 +117,18 @@ source `dirname ${BASH_SOURCE[0]}`/xnoshm.sh $1
115117

116118

117119
#卸载不必要组件
118-
cat > $ROOT/clean.sh <<EOF
120+
if [ ! -f $ROOT/clean.sh ]; then
121+
cat > $ROOT/clean.sh <<EOF
119122
# Save space
120-
[ -L /bin/X11 ] && /bin/unlink /bin/X11
121123
/bin/rm -rf /usr/share/doc
122124
/bin/rm -rf /usr/share/man
123125
/bin/rm -rf /tmp/*
124126
125127
# Clean up and exit
126128
no_need_pkgs="bsdmainutils compton debconf-i18n \
127129
fonts-noto-core fonts-symbola gdbm-l10n iptables \
128-
logrotate menu tasksel tzdata vim-common whiptail xxd
130+
logrotate menu tasksel tzdata vim-common \
131+
whiptail xxd
129132
"
130133
for i in \$no_need_pkgs; do
131134
/bin/echo [ /bin/apt purge \$i ]
@@ -137,7 +140,7 @@ done
137140
EOF
138141

139142
chroot $ROOT /bin/bash /clean.sh
140-
rm -f $ROOT/clean.sh
143+
fi
141144

142145

143146
# 确保宿主机当前用户相关目录或文件存在

0 commit comments

Comments
 (0)