fix runit install
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
# shellcheck shell=bash source=/dev/null
|
||||
# ~/.bash_profile: executed by the command interpreter for bash login shell.
|
||||
|
||||
[ -f ~/.sh_profile ] && . ~/.sh_profile
|
||||
|
||||
# bash-completion
|
||||
if ! shopt -oq posix && [ -z "${BASH_COMPLETION_VERSINFO-}" ]; then
|
||||
if [ "${BASH_VERSINFO[0]}" -gt 4 ] \
|
||||
@@ -17,3 +15,5 @@ if ! shopt -oq posix && [ -z "${BASH_COMPLETION_VERSINFO-}" ]; then
|
||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -f ~/.sh_profile ] && . ~/.sh_profile
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# shellcheck shell=sh source=/dev/null
|
||||
# ~/.sh_profile: executed by the command interpreter for login shells.
|
||||
# set -x
|
||||
|
||||
# source ~/.*aliases and ~/.*functions files
|
||||
for source in aliases functions; do
|
||||
@@ -36,3 +35,5 @@ for path in /*/local/sbin /*/local/bin /*/local/*/bin "${HOME}"/.*/bin; do
|
||||
*) export PATH="${path}:$PATH" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -f ~/.profile ] && . ~/.profile
|
||||
|
||||
@@ -9,11 +9,51 @@
|
||||
# Description: MYOS system calls
|
||||
### END INIT INFO
|
||||
|
||||
NAME="$(basename "$0")"
|
||||
|
||||
# check system config
|
||||
[ -r /etc/default/myos ] && . /etc/default/myos 2>/dev/null
|
||||
type make >/dev/null 2>&1 && [ -d "${MYOS}" ] || exit 1
|
||||
type make >/dev/null 2>&1 && [ -d "${MYOS}" ] && cd "${MYOS}" || exit 1
|
||||
|
||||
case "$1" in
|
||||
force-stop)
|
||||
HOOK="stop stack-node-stop"
|
||||
shift
|
||||
;;
|
||||
force-reload)
|
||||
HOOK="recreate stack-node-recreate"
|
||||
shift
|
||||
;;
|
||||
force-restart)
|
||||
HOOK="restart stack-node-restart"
|
||||
shift
|
||||
;;
|
||||
force-shutdown)
|
||||
HOOK="down stack-node-down"
|
||||
shift
|
||||
;;
|
||||
reload)
|
||||
HOOK="recreate"
|
||||
shift
|
||||
;;
|
||||
shutdown)
|
||||
HOOK="down"
|
||||
shift
|
||||
;;
|
||||
start)
|
||||
echo "Starting $NAME..."
|
||||
HOOK="up"
|
||||
shift
|
||||
;;
|
||||
status)
|
||||
HOOK="ps"
|
||||
shift
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping $NAME..."
|
||||
;;
|
||||
*)
|
||||
IFS=$'\n'; cd "${MYOS}"; exec env $(cat /etc/default/myos ~/.myos 2>/dev/null) make "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
IFS=$'\n'; exec env $(cat /etc/default/myos ~/.myos 2>/dev/null) make ${HOOK:-} "${@}"
|
||||
|
||||
@@ -10,7 +10,7 @@ start() {
|
||||
}
|
||||
|
||||
status() {
|
||||
/etc/init.d/myos ps
|
||||
/etc/init.d/myos status
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
@@ -9,10 +9,10 @@ start() {
|
||||
/etc/init.d/zram start
|
||||
}
|
||||
|
||||
stop() {
|
||||
/etc/init.d/zram stop
|
||||
}
|
||||
|
||||
status() {
|
||||
/etc/init.d/zram status
|
||||
}
|
||||
|
||||
stop() {
|
||||
/etc/init.d/zram stop
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# file rc_functions.sh: Define shell functions
|
||||
## author: Yann "aya" Autissier
|
||||
## license: GPL
|
||||
## version: 20210714
|
||||
## version: 20220620
|
||||
|
||||
# function force: Run a command sine die
|
||||
force() {
|
||||
@@ -135,8 +135,8 @@ ps1_set() {
|
||||
fi
|
||||
)"
|
||||
PS1_GIT="${COLOR_CYAN}${PS1_GIT}${COLOR_RESET}"
|
||||
PS1_HOSTNAME_COLOR="\`case \"\${ENV}\" in
|
||||
[Pp][Rr][0Oo][Dd]*)
|
||||
PS1_HOSTNAME_COLOR="\`case \"\${ENV}${HOSTNAME%%.*}\" in
|
||||
*[Pp][Rr][0Oo][Dd]*|*[Pp][Rr][Dd]*)
|
||||
printf \"${COLOR_RED}\";;
|
||||
*)
|
||||
if [ -n \"\${ENV}\" ]; then
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
NAME="$(basename "$(pwd)")"
|
||||
[ "$1" = -1 ] && echo "ERROR: unexpected error"
|
||||
|
||||
[ "$1" = 1 ] && echo "ERROR: $NAME config error" \
|
||||
&& sv d "$NAME" && exit 0
|
||||
|
||||
[ "$1" = 2 ] && echo "ERROR: $NAME exit error" \
|
||||
&& sv d "$NAME" && exit 0
|
||||
|
||||
exec /etc/init.d/"$NAME" stop 2>&1
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
NAME="$(basename "$(dirname "$(pwd)")")"
|
||||
LOG_DIR="/var/log/runit/$NAME"
|
||||
LOG_GROUP=adm
|
||||
LOG_USER=nobody
|
||||
SUPERVISE_DIR="/var/run/runit/supervise/${NAME}.log"
|
||||
|
||||
mkdir -p "$SUPERVISE_DIR" && chmod 700 "$SUPERVISE_DIR"
|
||||
[ ! -h supervise ] && rm -rf supervise && ln -s "$SUPERVISE_DIR" supervise
|
||||
mkdir -p "$LOG_DIR" && chmod 750 "$LOG_DIR"
|
||||
chown -R "$LOG_USER":"$LOG_GROUP" "$LOG_DIR"
|
||||
|
||||
exec chpst -u "$LOG_USER" svlogd -tt "$LOG_DIR"
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env /lib/runit/invoke-run
|
||||
# shellcheck shell=sh
|
||||
set -e
|
||||
|
||||
NAME="$(basename "$(dirname "$0")")"
|
||||
SUPERVISE_DIR="/var/run/runit/supervise/$NAME"
|
||||
|
||||
mkdir -p "$SUPERVISE_DIR" && chmod 700 "$SUPERVISE_DIR"
|
||||
[ ! -h supervise ] && rm -rf supervise && ln -s "$SUPERVISE_DIR" supervise
|
||||
|
||||
sv once "$NAME"
|
||||
exec /etc/init.d/"$NAME" start 2>&1
|
||||
Reference in New Issue
Block a user