diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat.ng b/xCAT-server/share/xcat/install/scripts/post.xcat.ng index 53a2fe878..255298db8 100644 --- a/xCAT-server/share/xcat/install/scripts/post.xcat.ng +++ b/xCAT-server/share/xcat/install/scripts/post.xcat.ng @@ -145,7 +145,10 @@ then /tmp/updateflag "$MASTER" "$XCATIPORT" "installstatus failed" sleep infinity fi -find /xcatpost -type f -maxdepth 1 -exec chmod 0755 {} + + +# Add execute permision to all files recursively under /xcatpost. +chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'` + msgutil_r "$MASTER_IP" "info" "postscripts downloaded successfully" "/var/log/xcat/xcat.log" "$log_label" # Get the precreated mypostscript file diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index f78bf840a..cfcd0832a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -18,6 +18,15 @@ check:rc==0 cmd:chtab key=nameservers site.value="" check:rc==0 +cmd:mkdir -p /install/postscripts/dir1/dir2/dir3 +check:rc==0 +cmd:echo -e '#!/bin/bash\n\necho \"Execute permission is set.\"\nexit 0'> /install/postscripts/dir1/dir2/dir3/foo.bar +check:rc==0 +cmd:chmod 755 /install/postscripts/dir1/dir2/dir3/foo.bar +check:rc==0 +cmd:chdef -p -t node -o $$CN postscripts="dir1/dir2/dir3/foo.bar" +check:rc==0 + cmd:makedns -n check:rc==0 cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $$CN;fi @@ -75,4 +84,20 @@ check:rc==0 cmd:if [ -x /usr/bin/goconserver ]; then makegocons -d $$CN; else makeconservercf -d $$CN; fi cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= + +cmd:xdsh $$CN "find /xcatpost/dir1/dir2/dir3/foo.bar -type f -perm -111 | egrep 'foo'" +check:rc==0 +cmd:xdsh $$CN "grep \"Execute permission is set\" /var/log/xcat/xcat.log" +check:rc==0 +check:output=~ Execute permission is set +cmd:rm -f /install/postscripts/dir1/dir2/dir3/foo.bar +check:rc==0 +cmd:cd /install/postscripts; rmdir -p dir1/dir2/dir3 +check:rc==0 +cmd:xdsh $$CN "rm -f /xcatpost/dir1/dir2/dir3/foo.bar" +check:rc==0 +cmd:xdsh $$CN "cd /xcatpost; rmdir -p dir1/dir2/dir3" +check:rc==0 +cmd:chdef -m -t node -o $$CN postscripts="dir1/dir2/dir3/foo.bar" +check:rc==0 end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index bd8fe4876..6dd07c8a8 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -14,6 +14,15 @@ cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpser cmd:chdef -t node $$SN groups=service,all check:rc==0 +cmd:mkdir -p /install/postscripts/dir1/dir2/dir3 +check:rc==0 +cmd:echo -e '#!/bin/bash\n\necho \"Execute permission is set.\"\nexit 0'> /install/postscripts/dir1/dir2/dir3/foo.bar +check:rc==0 +cmd:chmod 755 /install/postscripts/dir1/dir2/dir3/foo.bar +check:rc==0 +cmd:chdef -p -t node -o $$CN postscripts="dir1/dir2/dir3/foo.bar" +check:rc==0 + cmd:makedns -n check:rc==0 cmd:if [ -x /usr/bin/goconserver ]; then makegocons $$CN; else makeconservercf $$CN; fi @@ -82,4 +91,20 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons -d $$CN; else makeconserverc cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 + +cmd:xdsh $$CN "find /xcatpost/dir1/dir2/dir3/foo.bar -type f -perm -111 | egrep 'foo'" +check:rc==0 +cmd:xdsh $$CN "grep \"Execute permission is set\" /var/log/xcat/xcat.log" +check:rc==0 +check:output=~ Execute permission is set +cmd:rm -f /install/postscripts/dir1/dir2/dir3/foo.bar +check:rc==0 +cmd:cd /install/postscripts; rmdir -p dir1/dir2/dir3 +check:rc==0 +cmd:xdsh $$CN "rm -f /xcatpost/dir1/dir2/dir3/foo.bar" +check:rc==0 +cmd:xdsh $$CN "cd /xcatpost; rmdir -p dir1/dir2/dir3" +check:rc==0 +cmd:chdef -m -t node -o $$CN postscripts="dir1/dir2/dir3/foo.bar" +check:rc==0 end diff --git a/xCAT-test/autotest/testcase/updatenode/cases0 b/xCAT-test/autotest/testcase/updatenode/cases0 index 59281087e..fbce9a6cc 100644 --- a/xCAT-test/autotest/testcase/updatenode/cases0 +++ b/xCAT-test/autotest/testcase/updatenode/cases0 @@ -303,15 +303,15 @@ end start:updatenode_P_script1 label:others,updatenode -cmd:echo "echo hello > /tmp/updatenode_P_script" > /tmp/script1 +cmd:mkdir -p /install/postscripts/dir1/dir2/dir3 check:rc==0 -cmd:chmod a+x /tmp/script1 +cmd:echo "echo hello > /tmp/updatenode_P_script" > /install/postscripts/dir1/dir2/dir3/script1 check:rc==0 -cmd:cp /tmp/script1 /install/postscripts +cmd:chmod a+x /install/postscripts/dir1/dir2/dir3/script1 check:rc==0 -cmd:chdef $$CN postscripts=script1 +cmd:chdef $$CN postscripts=dir1/dir2/dir3/script1 check:rc==0 -cmd:updatenode $$CN -P script1 +cmd:updatenode $$CN -P dir1/dir2/dir3/script1 check:rc==0 check:output=~script1 cmd:xdsh $$CN "ls -l /tmp/updatenode_P_script" @@ -321,7 +321,15 @@ check:rc==0 check:output=~hello cmd:chdef $$CN postscripts= check:rc==0 -cmd:rm -f /install/script1 +cmd:rm -f /install/postscripts/dir1/dir2/dir3/script1 +check:rc==0 +cmd:cd /install/postscripts; rmdir -p dir1/dir2/dir3 +check:rc==0 +cmd:xdsh $$CN "rm /tmp/updatenode_P_script" +check:rc==0 +cmd:xdsh $$CN "rm -f /xcatpost/dir1/dir2/dir3/script1" +check:rc==0 +cmd:xdsh $$CN "cd /xcatpost; rmdir -p dir1/dir2/dir3" check:rc==0 end @@ -664,8 +672,3 @@ check:rc==0 cmd:rm -rf /install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.srcdstdiff.synclist check:rc==0 end - - - - -