1
0

Refactor IS_CHROOT

This commit is contained in:
nicolas.dorier
2019-06-25 17:29:01 +09:00
parent 38b09808b1
commit f2deb7a0df

View File

@@ -113,6 +113,11 @@ if [[ "$1" == "--install-only" ]]; then
START=false START=false
fi fi
IS_CHROOT=false
if [[ -x "$(command -v ischroot)" ]] && ischroot; then
IS_CHROOT=true
fi
if [[ -z "$BTCPAYGEN_CRYPTO1" ]]; then if [[ -z "$BTCPAYGEN_CRYPTO1" ]]; then
if [[ "$OSTYPE" != "darwin"* ]]; then if [[ "$OSTYPE" != "darwin"* ]]; then
# Not Mac OS - Mac OS uses it's own env file # Not Mac OS - Mac OS uses it's own env file
@@ -334,7 +339,7 @@ if ! [[ -x "$(command -v docker)" ]] || ! [[ -x "$(command -v docker-compose)" ]
# zlib1g:armhf is needed for docker-compose, but we install it here as we changed dpkg here # zlib1g:armhf is needed for docker-compose, but we install it here as we changed dpkg here
apt-get install -y docker-ce:armhf zlib1g:armhf apt-get install -y docker-ce:armhf zlib1g:armhf
fi fi
if [[ -x "$(command -v ischroot)" ]] && ischroot; then if $IS_CHROOT; then
echo "chroot detected, running dockerd in background..." echo "chroot detected, running dockerd in background..."
dockerd & dockerd &
echo "Waiting /var/run/docker.sock to be created..." echo "Waiting /var/run/docker.sock to be created..."
@@ -417,12 +422,12 @@ WantedBy=multi-user.target" > /etc/systemd/system/btcpayserver.service
echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n" echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n"
systemctl daemon-reload systemctl daemon-reload
systemctl enable btcpayserver systemctl enable btcpayserver
if $START; then if $START && ! $IS_CHROOT; then
echo "BTCPay Server starting... this can take 5 to 10 minutes..." echo "BTCPay Server starting... this can take 5 to 10 minutes..."
systemctl start btcpayserver systemctl start btcpayserver
echo "BTCPay Server started" echo "BTCPay Server started"
fi fi
$START && $IS_CHROOT && echo "Impossible to start a systemctl service in chroot... skipping"
elif [[ -x "$(command -v initctl)" ]]; then elif [[ -x "$(command -v initctl)" ]]; then
# Use upstart # Use upstart
echo "Using upstart" echo "Using upstart"
@@ -473,7 +478,7 @@ fi
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
install_tooling install_tooling
if ! $START && [[ -x "$(command -v ischroot)" ]] && ischroot; then if ! $START && $IS_CHROOT; then
echo "Killing dockerd in the background..." echo "Killing dockerd in the background..."
kill %- kill %-
fi fi