mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
Save copy of script to restart services
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
#!/command/with-contenv bashio
|
#!/command/with-contenv bashio
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
# Save a copy of the script for further restarts
|
||||||
|
if [ -f /etc/cont-init.d/99-run.sh ]; then
|
||||||
|
mkdir -p /etc/scripts-init
|
||||||
|
sed -i "s|/etc/cont-init.d|/etc/scripts-init|g" /ha_entrypoint.sh
|
||||||
|
cp /etc/cont-init.d/99-run.sh /etc/scripts-init/
|
||||||
|
fi
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# SET SYSTEM #
|
# SET SYSTEM #
|
||||||
##############
|
##############
|
||||||
@@ -61,14 +68,5 @@ if bashio::config.true "LIVESTREAM_BOOT_ENABLED"; then
|
|||||||
systemctl enable --now livestream.service >/dev/null
|
systemctl enable --now livestream.service >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save a copy of the script for further restarts
|
|
||||||
PREV_NUMBER="$(basename "$0" | grep -oE '^[0-9]+')"
|
|
||||||
NEW_NUMBER="$PREV_NUMBER"
|
|
||||||
until [[ "$NEW_NUMBER" -ne "$PREV_NUMBER" ]]; do
|
|
||||||
NEW_NUMBER=$((RANDOM % 99 + 1))
|
|
||||||
done
|
|
||||||
cp "$0" "${NEW_NUMBER}-run.sh"
|
|
||||||
chmod +x "${NEW_NUMBER}-run.sh"
|
|
||||||
|
|
||||||
# Start
|
# Start
|
||||||
bashio::log.info "✅ Setup complete."
|
bashio::log.info "✅ Setup complete."
|
||||||
|
|||||||
Reference in New Issue
Block a user