From bc2a2a39b4acf689124c3820a7cd87177505531b Mon Sep 17 00:00:00 2001 From: wiz Date: Mon, 7 Mar 2022 12:57:43 +0100 Subject: [PATCH] Add proper user creation to install script --- install | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/install b/install index e9c3bd0a7..537b49896 100755 --- a/install +++ b/install @@ -343,6 +343,7 @@ osUserCreate() { case $OS in FreeBSD) + # pw useradd -d /mempool -g mempool -n mempool osSudo "${ROOT_USER}" pw useradd $* ;; Debian) @@ -351,6 +352,18 @@ osUserCreate() esac } +osGroupCreate() +{ + case $OS in + FreeBSD) + osSudo "${ROOT_USER}" pw groupadd $* + ;; + Debian) + osSudo "${ROOT_USER}" groupadd $* + ;; + esac +} + osCertbotDryRun() { if [ ! -z "${HOSTNAME}" ];then @@ -699,18 +712,17 @@ set -x # Install all the OS packages # ############################### -osPackageUpdate -osPackageUpgrade -osPackageInstallAll - -exit 0 +#osPackageUpdate +#osPackageUpgrade +#osPackageInstallAll ########################## # Mempool top-level repo # ########################## echo "[*] Creating Mempool user with Tor access" -osUserCreate -d "${MEMPOOL_HOME}" -g "${MEMPOOL_GROUP}" -G "${TOR_GROUP}" "${MEMPOOL_USER}" +osGroupCreate "${MEMPOOL_GROUP}" +osUserCreate -d "${MEMPOOL_HOME}" -g "${MEMPOOL_GROUP}" -n "${MEMPOOL_USER}" id "${MEMPOOL_USER}" echo "[*] Creating Mempool data folder" osSudo "${ROOT_USER}" mkdir -p "${MEMPOOL_HOME}" @@ -719,6 +731,8 @@ echo "[*] Cloning Mempool repo from ${MEMPOOL_REPO_URL}" osSudo "${MEMPOOL_USER}" git config --global advice.detachedHead false osSudo "${MEMPOOL_USER}" git clone --branch "${MEMPOOL_REPO_BRANCH}" "${MEMPOOL_REPO_URL}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}" +exit 0 + #################### # Tor installation # #################### @@ -738,6 +752,9 @@ if [ "${TOR_INSTALL}" = ON ];then osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}" fi + # TODO: ADD mempool, bitcoin, bisq to tor group + # TODO: detect what the tor group is on this OS somehow + # start tor now so it can bootstrap in time for bitcoin starting a few mins later echo "[*] Starting Tor service" osSudo "${ROOT_USER}" service tor start