add esv - everest service manager

This commit is contained in:
lw-everestlinux 2022-10-11 07:45:59 -04:00
parent 3b76bb119f
commit c8aecefc2e
5 changed files with 104 additions and 0 deletions

6
src/bootstrap-glacier Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
tar -xvf glacier.tar.gz
cd src
chmod +x INSTALL.sh
./INSTALL.sh

72
src/esv/esv Executable file
View File

@ -0,0 +1,72 @@
#!/bin/sh
# Everest service manager
# (C) 2022 Everest Developers
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#source /etc/esv.conf
source $(pwd)/esv.conf # for testing purposes
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
printf "esv - Everest Service Manager\n"
printf "usage: esv {action} {service-name}\n"
printf "\n"
printf "esv {start} - start a service\n"
printf "esv {stop} - stop a currently running service\n"
printf "esv {restart} - restart a currently running service\n"
printf "esv {-h|--help} - print this message and exit\n"
printf "esv {-v|--version} - print the version and exit\n"
printf "\n"
printf "(C) 2022 Everest Developers\n"
printf "This program is free software: you can redistribute it and/or modify it\n"
printf "under the terms of the GNU General Public License as published by the\n"
printf "Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n"
exit 0
;;
start)
printf "$blue starting service $2...\n $reset"
$SRV_DIR/$2/$RUN
if [ "$?" != "0" ]; then
printf "$red service $2 could not start $reset \n"
exit 1
fi
printf "$green service $2 started succesfully $reset \n"
exit 0
;;
stop)
printf "$blue stopping service $2...$reset \n"
$SRV_DIR/$2/$STOP
if [ "$?" != "0" ]; then
printf "$red service $2 could not stop $reset \n"
exit 1
fi
printf "$blue service $2 stopped succesfully $reset \n"
exit 0
;;
restart)
printf "$blue restarting service $2... $reset \n"
$SRV_DIR/$2/$STOP && $SRV_DIR/$2/$RUN
if [ "$?" != "0" ]; then
printf "$red service $2 could not restart $reset \n"
exit 1
fi
printf "$green service $2 restarted successfully $reset \n"
exit 1
;;
*)
printf "$red invalid option specifieid, see 'esv --help' $reset \n"
exit 1
esac
done
printf "$red no option specified, see 'esv --help' $reset \n"

23
src/esv/esv.conf Executable file
View File

@ -0,0 +1,23 @@
# /etc/esv.conf
# Where services are stored.
# On Everest, this is /etc/init.d
export SRV_DIR="/etc/init.d"
# Name of start scripts. With
# services built for Everest, this
# is simply 'run'
export RUN="run"
# Name of stop scripts. With
# services built for Everest, this
# is simply 'stop'
export STOP="stop"
# Colors
export red="\033[1;31m"
export green="\033[1;32m"
export blue="\033[1;34m"
export reset="\033[m"
# end /etc/esv.conf

0
src/everest-chroot.sh → src/everest-chroot Normal file → Executable file
View File

3
src/setup-build-env Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh