From c8aecefc2e794d31a77366288f6888872b5df384 Mon Sep 17 00:00:00 2001 From: lw-everestlinux Date: Tue, 11 Oct 2022 07:45:59 -0400 Subject: [PATCH] add esv - everest service manager --- src/bootstrap-glacier | 6 ++ src/esv/esv | 72 +++++++++++++++++++++++ src/esv/esv.conf | 23 ++++++++ src/{everest-chroot.sh => everest-chroot} | 0 src/setup-build-env | 3 + 5 files changed, 104 insertions(+) create mode 100755 src/bootstrap-glacier create mode 100755 src/esv/esv create mode 100755 src/esv/esv.conf rename src/{everest-chroot.sh => everest-chroot} (100%) mode change 100644 => 100755 create mode 100755 src/setup-build-env diff --git a/src/bootstrap-glacier b/src/bootstrap-glacier new file mode 100755 index 0000000..cfd8893 --- /dev/null +++ b/src/bootstrap-glacier @@ -0,0 +1,6 @@ +#!/bin/sh + +tar -xvf glacier.tar.gz +cd src +chmod +x INSTALL.sh +./INSTALL.sh diff --git a/src/esv/esv b/src/esv/esv new file mode 100755 index 0000000..8b74eee --- /dev/null +++ b/src/esv/esv @@ -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 . + +#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" diff --git a/src/esv/esv.conf b/src/esv/esv.conf new file mode 100755 index 0000000..dd3b468 --- /dev/null +++ b/src/esv/esv.conf @@ -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 diff --git a/src/everest-chroot.sh b/src/everest-chroot old mode 100644 new mode 100755 similarity index 100% rename from src/everest-chroot.sh rename to src/everest-chroot diff --git a/src/setup-build-env b/src/setup-build-env new file mode 100755 index 0000000..829303e --- /dev/null +++ b/src/setup-build-env @@ -0,0 +1,3 @@ +#!/bin/sh + +