更新 1.sh 脚本,优化 Alpine 系统下的 shadow 包安装,添加 --no-cache 选项以减少缓存使用

This commit is contained in:
mini2024
2025-04-06 02:18:44 +08:00
parent a4bf202096
commit 5c3f651e7b

3
1.sh
View File

@ -21,11 +21,12 @@ if [ -f /etc/debian_version ]; then
chsh -s $(which bash) chsh -s $(which bash)
print_green "已将 bash 设置为默认 shell" print_green "已将 bash 设置为默认 shell"
elif [ -f /etc/alpine-release ]; then elif [ -f /etc/alpine-release ]; then
apk add shadow apk add --no-cache shadow
chsh -s $(which bash) root chsh -s $(which bash) root
# sed -i 's|^\(root:.*\):[^:]*$|\1:/bin/bash|' /etc/passwd # sed -i 's|^\(root:.*\):[^:]*$|\1:/bin/bash|' /etc/passwd
# sed -i 's|^\(root:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*\):[^:]*$|\1:/bin/bash|' /etc/passwd # sed -i 's|^\(root:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*\):[^:]*$|\1:/bin/bash|' /etc/passwd
print_yellow "已将 bash 设置为默认 shell" print_yellow "已将 bash 设置为默认 shell"
apk del shadow
fi fi
# 先检查是 Debian 还是 Alpine # 先检查是 Debian 还是 Alpine