2024-09-17 12:01:20 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
##@Version : 202409171124-git
|
|
|
|
# @@Author : CasjaysDev
|
|
|
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
|
|
|
# @@License : MIT
|
|
|
|
# @@ReadME :
|
|
|
|
# @@Copyright : Copyright 2023 CasjaysDev
|
|
|
|
# @@Created : Mon Aug 28 06:48:42 PM EDT 2023
|
|
|
|
# @@File : 01-system.sh
|
|
|
|
# @@Description : script to run system
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# shellcheck shell=bash
|
|
|
|
# shellcheck disable=SC2016
|
|
|
|
# shellcheck disable=SC2031
|
|
|
|
# shellcheck disable=SC2120
|
|
|
|
# shellcheck disable=SC2155
|
|
|
|
# shellcheck disable=SC2199
|
|
|
|
# shellcheck disable=SC2317
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Set bash options
|
|
|
|
set -o pipefail
|
|
|
|
[ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Set env variables
|
|
|
|
exitCode=0
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Predifined actions
|
2024-09-17 15:38:24 -04:00
|
|
|
cat <<EOF >"/etc/rc.local"
|
|
|
|
#!/bin/bash
|
|
|
|
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
|
|
|
|
|
|
|
|
[ ! -f "/data/.installed" ] && [ -f "/usr/local/bin/coolify-setup" ] && export COOLIFY_INIT=yes;bash -c "/usr/local/bin/coolify-setup"
|
|
|
|
|
|
|
|
touch /var/lock/subsys/local
|
|
|
|
exit 0
|
|
|
|
EOF
|
|
|
|
cat <<HERE >"/etc/systemd/system/rc-local.service"
|
|
|
|
[Unit]
|
|
|
|
Description=/etc/rc.local
|
|
|
|
ConditionPathExists=/etc/rc.local
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=forking
|
|
|
|
ExecStart=/etc/rc.local start
|
|
|
|
TimeoutSec=0
|
|
|
|
StandardOutput=tty
|
|
|
|
RemainAfterExit=yes
|
|
|
|
SysVStartPriority=99
|
2024-09-17 12:01:20 -04:00
|
|
|
|
2024-09-17 15:38:24 -04:00
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
HERE
|
|
|
|
sudo chmod +x /etc/rc.local
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable rc-local
|
2024-09-17 12:01:20 -04:00
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Main script
|
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Set the exit code
|
|
|
|
exitCode=$?
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
exit $exitCode
|