Compare commits
5 Commits
4bafae84fb
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 821158c896 | |||
| 3371bb0b32 | |||
| 3b14853aa6 | |||
| bc3d8bf1ce | |||
| f52dfc9c2b |
@@ -25,7 +25,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://dock-it.dev/actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||
uses: https://dock-it.dev/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://dock-it.dev/actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
||||
uses: https://dock-it.dev/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: https://dock-it.dev/actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
||||
uses: https://dock-it.dev/actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
4
go.mod
4
go.mod
@@ -10,7 +10,7 @@ require (
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
golang.org/x/crypto v0.53.0
|
||||
modernc.org/sqlite v1.52.0
|
||||
modernc.org/sqlite v1.53.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -22,7 +22,7 @@ require (
|
||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
golang.org/x/sys v0.46.0 // indirect
|
||||
modernc.org/libc v1.72.3 // indirect
|
||||
modernc.org/libc v1.73.4 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
)
|
||||
|
||||
4
go.sum
4
go.sum
@@ -35,9 +35,13 @@ golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
|
||||
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
modernc.org/libc v1.72.3 h1:ZnDF4tXn4NBXFutMMQC4vtbTFSXhhKzR73fv0beZEAU=
|
||||
modernc.org/libc v1.72.3/go.mod h1:dn0dZNnnn1clLyvRxLxYExxiKRZIRENOfqQ8XEeg4Qs=
|
||||
modernc.org/libc v1.73.4 h1:+ra4Ui8ngyt8HDcO1FTDPWlkAh6yOdaO2yAoh8MddQA=
|
||||
modernc.org/libc v1.73.4/go.mod h1:DXZ3eO8qMCNn2SnmTNCiC71nJ9Rcq3PsnpU6Vc4rWK8=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||
modernc.org/sqlite v1.52.0 h1:p4dhYh2tXZCiyaqHwRVJDjIGKWyXayiQpThxgDzJaxo=
|
||||
modernc.org/sqlite v1.52.0/go.mod h1:tcNzv5p84E0skkmJn038y+hWJbLQXQqEnQfeh5r2JLM=
|
||||
modernc.org/sqlite v1.53.0 h1:20WG8N9q4ji/dEqGk4uiI0c6OPjSeLTNYGFCc3+7c1M=
|
||||
modernc.org/sqlite v1.53.0/go.mod h1:xoEpOIpGrgT48H5iiyt/YXPCZPEzlfmfFwtk8Lklw8s=
|
||||
|
||||
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