From 9f6750f9b72becd767f5361f934fd894371b3ecc Mon Sep 17 00:00:00 2001 From: santic-zombie Date: Sun, 23 Jun 2024 18:21:27 +0300 Subject: [PATCH] Final fixes --- opennebula-common/APKBUILD | 4 ---- opennebula-common/opennebula-common.post-deinstall | 9 ++++++--- opennebula-common/opennebula-common.post-install | 5 ++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/opennebula-common/APKBUILD b/opennebula-common/APKBUILD index 6714102..c4f2e00 100644 --- a/opennebula-common/APKBUILD +++ b/opennebula-common/APKBUILD @@ -21,10 +21,6 @@ source=" ssh-config" package() { -# install -dm750 "${pkgdir}/var/lock/one" -# install -dm750 "${pkgdir}/var/log/one" -# install -dm750 "${pkgdir}/var/run/one" - install -Dm755 "${srcdir}/ssh-config" "${pkgdir}/usr/share/one/ssh/config" } sha512sums="71c4ebfa1b1c32c59b0fead99730604e0edba617f6d6b9a4e9a4d9671fbe75c60f9f4d53fb5e2f35d7c632c7e308bd047af2f1db769de4134eb078d7b0fc3486 ssh-config" diff --git a/opennebula-common/opennebula-common.post-deinstall b/opennebula-common/opennebula-common.post-deinstall index 6236587..634dba4 100644 --- a/opennebula-common/opennebula-common.post-deinstall +++ b/opennebula-common/opennebula-common.post-deinstall @@ -2,9 +2,12 @@ set -e -userdel -r oneadmin && echo ">> User 'oneadmin' has been removed." -groupdel cloud && echo ">> Group 'cloud' has been removed." +ONE_GROUP=cloud +ONE_USER=oneadmin -rm -rf /var/lib/one /var/run/one /var/log/one /var/lock/one +userdel -r ${ONE_USER} 2>/dev/null && echo ">> User '${ONE_USER}' has been removed." +groupdel ${ONE_GROUP} 2>/dev/null && echo ">> Group '${ONE_GROUP}' has been removed." + +rm -rf /var/lib/one /var/run/one /var/log/one /var/lock/one 2>/dev/null exit 0 diff --git a/opennebula-common/opennebula-common.post-install b/opennebula-common/opennebula-common.post-install index 48da0dc..8792e0e 100644 --- a/opennebula-common/opennebula-common.post-install +++ b/opennebula-common/opennebula-common.post-install @@ -32,7 +32,7 @@ create_oneuser() { create_cloudgroup create_oneuser -# install ~oneadmin/.ssh/config if not present on a fresh install only +# Install ~oneadmin/.ssh/config if not present on a fresh install only if [ ! -e "${ONEHOME}/.ssh/config" ] && [ -z "$2" ]; then if [ ! -d "${ONEHOME}/.ssh" ]; then mkdir -p "${ONEHOME}/.ssh" @@ -44,14 +44,13 @@ if [ ! -e "${ONEHOME}/.ssh/config" ] && [ -z "$2" ]; then chown "$ONE_USER:$ONE_GROUP" "${ONEHOME}/.ssh/config" fi -# Fix permissions oneadmin:cloud +# Set permissions and owner oneadmin:cloud for F in /var/lock/one /var/log/one /var/run/one do if [ ! -d "${F}" ]; then mkdir -p "${F}" chmod 0750 "${F}" chown "${ONE_USER}:${ONE_GROUP}" "${F}" - echo "CHOWNED ${F}" fi done