diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index a35a76446..601af8ab9 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -270,9 +270,18 @@ if [ $? -eq 0 ]; then fi if [ $hassystemd -eq 1 ] ; then - cat >/etc/systemd/system/xcatpostinit1.service <<'EOF' + if [[ $OSVER == sles12* ]]; then + cat >/etc/systemd/system/xcatpostinit1.service <<'EOF' +#INCLUDE:/install/postscripts/xcatpostinit1.service.yast2# +EOF + cat >/opt/xcat/xcatpostinit1.service.sles <<'EOF' #INCLUDE:/install/postscripts/xcatpostinit1.service# EOF + else + cat >/etc/systemd/system/xcatpostinit1.service <<'EOF' +#INCLUDE:/install/postscripts/xcatpostinit1.service# +EOF + fi if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "/etc/systemd/system/xcatpostinit1.service generated" "/var/log/xcat/xcat.log" "$log_label" fi diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index 21bf77392..4c7823216 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -48,6 +48,10 @@ start) if [ -r /opt/xcat/xcatinstallpost ]; then /opt/xcat/xcatinstallpost fi + if [ -f /opt/xcat/xcatpostinit1.service.sles ]; then + rm -rf /etc/systemd/system/xcatpostinit1.service + mv /opt/xcat/xcatpostinit1.service.sles /etc/systemd/system/xcatpostinit1.service + fi fi ;; diff --git a/xCAT/postscripts/xcatpostinit1.service.yast2 b/xCAT/postscripts/xcatpostinit1.service.yast2 new file mode 100644 index 000000000..deac8b273 --- /dev/null +++ b/xCAT/postscripts/xcatpostinit1.service.yast2 @@ -0,0 +1,12 @@ +[Unit] +Description=xcat service on compute node, the framework to run postbootscript during OS provision +After=network.target rsyslog.service YaST2-Firstboot.service + +[Service] +Type=oneshot +ExecStart=/opt/xcat/xcatpostinit1 start +ExecStop=/opt/xcat/xcatpostinit1 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target