Files
umbrel-apps/bassin/hooks/pre-start
T
c634439ff4 Update Bassin to 2.1.0 (#4194)
Co-authored-by: duckaxe <>
Co-authored-by: nmfretz <nmfretz@gmail.com>
2025-12-09 10:56:20 +10:00

33 lines
997 B
Bash
Executable File

#!/usr/bin/env bash
# This script updates the btcsig in ckpool.conf for existing users
# who installed when the default was "/mined by Bassin/"
# Only runs once to avoid overriding user's intentional changes
APP_DATA_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")"
CKPOOL_CONFIG_FILE="${APP_DATA_DIR}/data/config/ckpool.conf"
BTCSIG_MIGRATION_FLAG="${APP_DATA_DIR}/BTCSIG_MIGRATED"
# Skip if migration has already run
if [[ -f "${BTCSIG_MIGRATION_FLAG}" ]]; then
exit
fi
# Check if the config file exists
if [[ ! -f "${CKPOOL_CONFIG_FILE}" ]]; then
touch "${BTCSIG_MIGRATION_FLAG}"
exit
fi
OLD_BTCSIG='"btcsig" : "/mined by Bassin/",'
NEW_BTCSIG='"btcsig" : "/mined by Bassin on Umbrel/",'
# Check if the exact old btcsig line exists
if grep -qF "${OLD_BTCSIG}" "${CKPOOL_CONFIG_FILE}"; then
echo "App: ${APP_ID} - Updating btcsig in ckpool.conf"
sed -i "s|${OLD_BTCSIG}|${NEW_BTCSIG}|" "${CKPOOL_CONFIG_FILE}"
fi
# Mark migration as complete
touch "${BTCSIG_MIGRATION_FLAG}"