2022-05-26 16:08:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-04-13 01:43:51 +00:00
|
|
|
# Identify OS and Variant
|
|
|
|
OS="$(grep '^ID=' /etc/os-release | cut -d= -f2)"
|
|
|
|
VARIANT="$(grep '^VARIANT_ID=' /etc/os-release | cut -d= -f2)"
|
|
|
|
if [ -n "$VARIANT" ]; then
|
|
|
|
OS="${OS}-${VARIANT}"
|
|
|
|
fi
|
2022-05-26 16:08:29 +00:00
|
|
|
|
2023-04-13 01:43:51 +00:00
|
|
|
# Build log file for upgradeable package counts/errors
|
2024-03-08 19:11:04 +00:00
|
|
|
COUNT_FILE="$HOME/.local/state/upgradeable"
|
2023-04-13 01:43:51 +00:00
|
|
|
if [ -f "/run/.containerenv" ] || [ -f "/.dockerenv" ]; then
|
|
|
|
COUNT_FILE="$COUNT_FILE.$(echo "$HOSTNAME" | cut -d'.' -f1)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build command
|
|
|
|
CMD=${0//pkg/pkg-$OS}
|
|
|
|
|
|
|
|
# Log error if command does not exist and exit
|
|
|
|
if [ ! -f "$CMD" ]; then
|
|
|
|
echo "ERROR: unsupported OS/variant '$OS' due to missing script: $CMD" > "$COUNT_FILE"
|
|
|
|
exit
|
|
|
|
fi
|
2022-05-26 16:08:29 +00:00
|
|
|
|
|
|
|
# Run appropriate script from same path as this one
|
2023-04-13 01:43:51 +00:00
|
|
|
$CMD "$@"
|