]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Removing user and group 'cloud-user' on postinstall actions
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 23 Jan 2024 15:03:14 +0000 (16:03 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 23 Jan 2024 15:03:14 +0000 (16:03 +0100)
postinstall-scripts/update-all-packages

index c5444be5f4db84986c87a62b24f1e6a76519bf89..136061735c5b4aea742460e99402adf1cc6d830d 100755 (executable)
@@ -198,6 +198,7 @@ ok==1 {print "ip_resolve=4"; ok=0}
     if rpm -qa | grep --quiet --perl-regexp '^cloud-init-\d' ; then
         exec_cmd ${tool}  --assumeyes erase cloud-init
         RM -rf /etc/sysconfig/network-scripts/* /etc/sysconfig/network-scripts/.*
+        sleep 1
     fi
 
     for logfile in /var/log/cloud-init.log /var/log/cloud-init-output.log ; do
@@ -208,6 +209,18 @@ ok==1 {print "ip_resolve=4"; ok=0}
         RM "${logfile}}"
     done
 
+    if getent passwd cloud-user >/dev/null; then
+        info "Removing user 'cloud-user' ..."
+        exec_cmd userdel -r cloud-user
+        sleep 1
+    fi
+
+    if getent group cloud-user >/dev/null; then
+        info "Removing group 'cloud-user' ..."
+        exec_cmd groupdel cloud-user
+        sleep 1
+    fi
+
     echo
     info "Doing upgrade ..."
     exec_cmd ${tool} --assumeyes upgrade