You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

51 lines
1.5 KiB

#!/usr/bin/env bash
UMBREL_ROOT="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/../.."
UMBREL_OS_SCRIPTS="${UMBREL_ROOT}/scripts/umbrel-os"
# Creates, enables and starts a systemd service
enable_service() {
service="${1}"
if [ ! -f "/etc/systemd/system/${service}" ]; then
echo "Setting up ${service}"
if [ ! -f "${UMBREL_OS_SCRIPTS}/services/${service}" ]; then
echo "Error: No service file found at ${UMBREL_OS_SCRIPTS}/services/${service}"
exit 1
fi
echo "Copying ${service} to /etc/systemd/system/${service}"
cp "${UMBREL_OS_SCRIPTS}/services/${service}" "/etc/systemd/system/${service}"
echo "Enabling ${service}..."
systemctl enable "${service}"
echo "Starting ${service}..."
systemctl start "${service}"
fi
}
# Configure Umbrel on first boot
# We assume that it's the first boot if Umbrel hasn't been configured
if [ ! -f "${UMBREL_ROOT}/statuses/configured" ]; then
echo
echo "======================================"
echo "============ FIRST BOOT =============="
echo "=========== hello world! ============="
echo "======================================"
echo
echo "Configuring Umbrel..."
echo
if [ -f "${UMBREL_ROOT}/scripts/configure" ]; then
cd "$UMBREL_ROOT"
NETWORK=mainnet ./scripts/configure || exit 1
else
echo "Error: No configuration script found at ${UMBREL_ROOT}/scripts/configure"
exit 1
fi
fi
# Enable all services
enable_service "umbrel-external-storage.service"
enable_service "umbrel-startup.service"
enable_service "umbrel-connection-details.service"
exit 0