From 08154d989c5b0b8ca3d922e2c98e4efd012cbb66 Mon Sep 17 00:00:00 2001 From: santic-zombie Date: Sat, 22 Jun 2024 23:09:45 +0300 Subject: [PATCH] Fixed post-install script and added post-install --- opennebula-common/APKBUILD | 3 ++- opennebula-common/opennebula-common.post-install | 2 +- opennebula-common/opennebula.post-deinstall | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 opennebula-common/opennebula.post-deinstall diff --git a/opennebula-common/APKBUILD b/opennebula-common/APKBUILD index 60b8629..095a826 100644 --- a/opennebula-common/APKBUILD +++ b/opennebula-common/APKBUILD @@ -14,7 +14,8 @@ depends=" openssh-client" install=" - ${pkgname}.post-install" + ${pkgname}.post-install + ${pkgname}.post-deinstall" source=" ssh-config" diff --git a/opennebula-common/opennebula-common.post-install b/opennebula-common/opennebula-common.post-install index 5b9c1bb..675c25c 100644 --- a/opennebula-common/opennebula-common.post-install +++ b/opennebula-common/opennebula-common.post-install @@ -17,7 +17,7 @@ create_cloudgroup() { create_oneuser() { if ! getent passwd $ONE_USER > /dev/null 2>&1; then - adduser --system --gecos $ONE_COMMENT --uid $ONE_UID --ingroup $ONE_GROUP --home $ONEHOME --shell /bin/ash $ONE_USER + adduser --system --gecos "$ONE_COMMENT" --uid $ONE_UID --ingroup $ONE_GROUP --home $ONEHOME --shell /bin/ash $ONE_USER else ONEHOME=`getent passwd $ONE_USER | cut -f6 -d:` # Renable user (give him a shell) diff --git a/opennebula-common/opennebula.post-deinstall b/opennebula-common/opennebula.post-deinstall new file mode 100644 index 0000000..b009fd4 --- /dev/null +++ b/opennebula-common/opennebula.post-deinstall @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +rm -rf /var/lib/one /var/run/one /var/log/one /var/lock/one + +userdel -r oneadmin && echo ">> User 'oneadmin' has been removed." +groupdel cloud && echo ">> Group 'cloud' has been removed." + +exit 0