Add proper user creation to install script

This commit is contained in:
wiz 2022-03-07 12:57:43 +01:00
parent fc92080d55
commit bc2a2a39b4
No known key found for this signature in database
GPG Key ID: A394E332255A6173

29
install
View File

@ -343,6 +343,7 @@ osUserCreate()
{ {
case $OS in case $OS in
FreeBSD) FreeBSD)
# pw useradd -d /mempool -g mempool -n mempool
osSudo "${ROOT_USER}" pw useradd $* osSudo "${ROOT_USER}" pw useradd $*
;; ;;
Debian) Debian)
@ -351,6 +352,18 @@ osUserCreate()
esac esac
} }
osGroupCreate()
{
case $OS in
FreeBSD)
osSudo "${ROOT_USER}" pw groupadd $*
;;
Debian)
osSudo "${ROOT_USER}" groupadd $*
;;
esac
}
osCertbotDryRun() osCertbotDryRun()
{ {
if [ ! -z "${HOSTNAME}" ];then if [ ! -z "${HOSTNAME}" ];then
@ -699,18 +712,17 @@ set -x
# Install all the OS packages # # Install all the OS packages #
############################### ###############################
osPackageUpdate #osPackageUpdate
osPackageUpgrade #osPackageUpgrade
osPackageInstallAll #osPackageInstallAll
exit 0
########################## ##########################
# Mempool top-level repo # # Mempool top-level repo #
########################## ##########################
echo "[*] Creating Mempool user with Tor access" 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}" id "${MEMPOOL_USER}"
echo "[*] Creating Mempool data folder" echo "[*] Creating Mempool data folder"
osSudo "${ROOT_USER}" mkdir -p "${MEMPOOL_HOME}" 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 config --global advice.detachedHead false
osSudo "${MEMPOOL_USER}" git clone --branch "${MEMPOOL_REPO_BRANCH}" "${MEMPOOL_REPO_URL}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}" osSudo "${MEMPOOL_USER}" git clone --branch "${MEMPOOL_REPO_BRANCH}" "${MEMPOOL_REPO_URL}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}"
exit 0
#################### ####################
# Tor installation # # Tor installation #
#################### ####################
@ -738,6 +752,9 @@ if [ "${TOR_INSTALL}" = ON ];then
osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}" osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}"
fi 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 # start tor now so it can bootstrap in time for bitcoin starting a few mins later
echo "[*] Starting Tor service" echo "[*] Starting Tor service"
osSudo "${ROOT_USER}" service tor start osSudo "${ROOT_USER}" service tor start