feat(install): print access details after setup
This commit is contained in:
88
install.sh
88
install.sh
@@ -16,6 +16,7 @@ SYSTEMD_UNIT="/etc/systemd/system/maintainarr.service"
|
||||
UPDATE_SCRIPT="/usr/local/bin/maintainarr-update"
|
||||
CRON_FILE="/etc/cron.d/maintainarr-update"
|
||||
GO_VERSION="${MAINTAINARR_GO_VERSION:-1.26.4}"
|
||||
INSTALL_COMMAND="curl -fsSL https://dock-it.dev/Idea-Studios/Maintainarr/raw/branch/main/install.sh | sudo bash"
|
||||
|
||||
log() {
|
||||
printf '[maintainarr] %s\n' "$*"
|
||||
@@ -256,6 +257,77 @@ random_hex() {
|
||||
od -An -N"$bytes" -tx1 /dev/urandom | tr -d ' \n'
|
||||
}
|
||||
|
||||
env_value() {
|
||||
local key="$1"
|
||||
awk -F= -v target="$key" '$1 == target { sub(/^[^=]+=*/, "", $0); print $0; exit }' "$ENV_FILE"
|
||||
}
|
||||
|
||||
extract_port() {
|
||||
local addr="$1"
|
||||
|
||||
if [[ "$addr" =~ :([0-9]+)$ ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "8080"
|
||||
}
|
||||
|
||||
detect_local_ip() {
|
||||
local ip=""
|
||||
|
||||
if command_exists hostname; then
|
||||
ip="$(hostname -I 2>/dev/null | awk '{print $1}')"
|
||||
fi
|
||||
|
||||
if [[ -z "$ip" ]] && command_exists ip; then
|
||||
ip="$(ip route get 1.1.1.1 2>/dev/null | awk '/src/ {for (i=1;i<=NF;i++) if ($i=="src") {print $(i+1); exit}}')"
|
||||
fi
|
||||
|
||||
if [[ -z "$ip" ]]; then
|
||||
ip="127.0.0.1"
|
||||
fi
|
||||
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
print_summary() {
|
||||
local local_ip="$1"
|
||||
local port="$2"
|
||||
local auto_updates="$3"
|
||||
local start_on_boot="$4"
|
||||
local addr base_url
|
||||
|
||||
addr="$(env_value "MAINTAINARR_ADDR")"
|
||||
base_url="$(env_value "MAINTAINARR_BASE_URL")"
|
||||
|
||||
printf '\n'
|
||||
printf 'Maintainarr install complete\n'
|
||||
printf 'Local URL: http://%s:%s\n' "$local_ip" "$port"
|
||||
printf 'Base URL: %s\n' "$base_url"
|
||||
printf '\n'
|
||||
printf 'Settings\n'
|
||||
printf 'MAINTAINARR_ADDR=%s\n' "$addr"
|
||||
printf 'MAINTAINARR_DB_PATH=%s\n' "$(env_value "MAINTAINARR_DB_PATH")"
|
||||
printf 'MAINTAINARR_LOG_ARCHIVE_DIR=%s\n' "$(env_value "MAINTAINARR_LOG_ARCHIVE_DIR")"
|
||||
printf 'MAINTAINARR_ORG_NAME=%s\n' "$(env_value "MAINTAINARR_ORG_NAME")"
|
||||
printf 'MAINTAINARR_BASE_URL=%s\n' "$base_url"
|
||||
printf 'MAINTAINARR_THEME=%s\n' "$(env_value "MAINTAINARR_THEME")"
|
||||
printf 'MAINTAINARR_THEME_MODE=%s\n' "$(env_value "MAINTAINARR_THEME_MODE")"
|
||||
printf 'MAINTAINARR_REFRESH_CRON=%s\n' "$(env_value "MAINTAINARR_REFRESH_CRON")"
|
||||
printf 'AUTO_UPDATES=%s\n' "$auto_updates"
|
||||
printf 'START_ON_BOOT=%s\n' "$start_on_boot"
|
||||
printf '\n'
|
||||
printf 'Paths\n'
|
||||
printf 'Config: %s\n' "$ENV_FILE"
|
||||
printf 'Data: %s\n' "$DATA_DIR"
|
||||
printf 'Source: %s\n' "$SRC_DIR"
|
||||
printf 'Binary: %s\n' "$BIN_PATH"
|
||||
printf '\n'
|
||||
printf 'Re-run installer\n'
|
||||
printf '%s\n' "$INSTALL_COMMAND"
|
||||
}
|
||||
|
||||
write_env_file() {
|
||||
mkdir -p "$CONFIG_DIR" "$DATA_DIR/log-archives"
|
||||
|
||||
@@ -379,6 +451,10 @@ EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
local auto_updates="disabled"
|
||||
local start_on_boot="disabled"
|
||||
local addr port local_ip
|
||||
|
||||
require_root
|
||||
install_base_packages
|
||||
install_go
|
||||
@@ -394,6 +470,7 @@ main() {
|
||||
|
||||
if prompt_yes_no "Enable automatic daily updates with cron?" "n"; then
|
||||
configure_auto_updates
|
||||
auto_updates="enabled"
|
||||
else
|
||||
rm -f "$CRON_FILE"
|
||||
log "Skipped cron auto-update setup"
|
||||
@@ -401,16 +478,17 @@ main() {
|
||||
|
||||
if prompt_yes_no "Start Maintainarr at boot with systemd?" "y"; then
|
||||
enable_start_on_boot
|
||||
start_on_boot="enabled"
|
||||
else
|
||||
log "Skipped boot-start setup"
|
||||
log "Run it manually with: $BIN_PATH"
|
||||
fi
|
||||
|
||||
log "Install complete"
|
||||
log "Config: $ENV_FILE"
|
||||
log "Data: $DATA_DIR"
|
||||
log "Source: $SRC_DIR"
|
||||
log "Binary: $BIN_PATH"
|
||||
addr="$(env_value "MAINTAINARR_ADDR")"
|
||||
port="$(extract_port "$addr")"
|
||||
local_ip="$(detect_local_ip)"
|
||||
|
||||
print_summary "$local_ip" "$port" "$auto_updates" "$start_on_boot"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user