summaryrefslogtreecommitdiffstats
path: root/debian/cephadm.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:46:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:46:10 +0000
commit7050cdb205fd1b1b847c148092a8548f00a061c0 (patch)
tree05a497ffd12f14405445c3288085e228f4e8579f /debian/cephadm.postinst
parentAdding upstream version 16.2.11+ds. (diff)
downloadceph-7050cdb205fd1b1b847c148092a8548f00a061c0.tar.xz
ceph-7050cdb205fd1b1b847c148092a8548f00a061c0.zip
Adding debian version 16.2.11+ds-2.debian/16.2.11+ds-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/cephadm.postinst')
-rw-r--r--debian/cephadm.postinst46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/cephadm.postinst b/debian/cephadm.postinst
new file mode 100644
index 000000000..2ff4cf460
--- /dev/null
+++ b/debian/cephadm.postinst
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+CEPHADM_HOME=/var/lib/cephadm
+
+if [ "${1}" = "configure" ] || [ "${1}" = "reconfigure" ] ; then
+ if ! getent group cephadm > /dev/null 2>&1 ; then
+ addgroup --quiet --system cephadm ${ADDGROUP_PARAM}
+ fi
+
+ if ! getent passwd cephadm ; then
+ echo -n "Adding system user cephadm..."
+ adduser --system \
+ --home /var/lib/cephadm \
+ --no-create-home \
+ --quiet \
+ --disabled-password \
+ --gecos 'cephadm user for mgr/cephadm' \
+ --shell /bin/bash \
+ --ingroup cephadm \
+ cephadm 2>/dev/null || true
+ echo "done"
+ fi
+
+ if [ ! -d ${CEPHADM_HOME} ] ; then
+ mkdir -p ${CEPHADM_HOME}
+ fi
+ chown cephadm:cephadm ${CEPHADM_HOME}
+ chmod 0755 ${CEPHADM_HOME}
+
+ if ! [ -d ${CEPHADM_HOME}/.ssh ] ; then
+ mkdir ${CEPHADM_HOME}/.ssh
+ chown --reference ${CEPHADM_HOME} ${CEPHADM_HOME}/.ssh
+ chmod 0700 ${CEPHADM_HOME}/.ssh
+ fi
+ if ! [ -e ${CEPHADM_HOME}/.ssh/authorized_keys ] ; then
+ touch ${CEPHADM_HOME}/.ssh/authorized_keys
+ chown --reference ${CEPHADM_HOME} ${CEPHADM_HOME}/.ssh/authorized_keys
+ chmod 0600 ${CEPHADM_HOME}/.ssh/authorized_keys
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0