From 1c1652f1b1305d7855e608274db7b886e4a51a90 Mon Sep 17 00:00:00 2001 From: realpan Date: Mon, 27 Feb 2023 08:38:21 +0000 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E2=80=9D=E7=BA=A4=E5=A4=AB?= =?UTF-8?q?=E7=9A=84=E7=88=B1=E2=80=9C=E6=96=B9=E6=A1=88=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=B7=A5=E5=85=B7=E8=BF=90=E8=A1=8C=E5=90=8E=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E9=87=8D=E5=A4=8D=E5=86=99=E5=85=A5=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: realpan --- security-tool.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/security-tool.sh b/security-tool.sh index c6bc4e7..b6914dd 100644 --- a/security-tool.sh +++ b/security-tool.sh @@ -643,8 +643,12 @@ function fn_handle_umask() if [ "$target" == "user" ] then - echo "umask $value" >> "$ROOTFS/etc/bashrc" - echo "umask $value" >> "$ROOTFS/etc/csh.cshrc" + if ! grep -q "^umask $value" $ROOTFS/etc/bashrc;then + echo "umask $value" >> "$ROOTFS/etc/bashrc" + fi + if ! grep -q "^umask $value" $ROOTFS/etc/csh.cshrc;then + echo "umask $value" >> "$ROOTFS/etc/csh.cshrc" + fi for file in $(find "$ROOTFS/etc/profile.d/" -type f) do echo '' >> $file # 防止配置文件末尾没有换行符的情况 -- Gitee