This commit is contained in:
Liam Waldron 2023-03-22 14:00:58 -04:00
parent e66ebba7f9
commit 17d4590426
8 changed files with 177 additions and 7 deletions

3
README
View File

@ -31,4 +31,5 @@ OR Install only certain tools
∟ libesv - backend for esv
gpc - Glacier Package Checker
ecrypt - Everest Encryption Tools
emk - Simple shell script based build system
emk - Simple shell script based build system
mkskel - Create a filesystem skeleton

View File

@ -111,9 +111,9 @@ distclean_pkg() {
# These should not be modified unless adding support for custom funtions
case $1 in
help) # Put a list of all available tasks here
showhelp) # Put a list of all available tasks here
#printf "make - compile program\n"
#printf "install - install program\n"
printf "install - install every tool under this repository\n"
#printf "clean - clean all files generated by make\n"
#printf "distclean - clean all files not in the source tree\n"
#exit 0
@ -134,8 +134,8 @@ case $1 in
distclean_pkg "$@"
exit 0
;;
*)
printf "emk ${red}ERR${reset} | no such task exists\n"
exit 1
;;
#*)
# printf "emk ${red}ERR${reset} | no such task exists\n"
# exit 1
#;;
esac

0
install/install.conf Normal file
View File

View File

@ -0,0 +1,9 @@
#!/usr/bin/env /bin/sh
# ecrypt-genkey - A simple bash script for generating keys, passwords, etc
#
# Copyright (C) 2023 Everest Linux
#
# This program is free software. See the GNU GPL v3.0 for more information/
letters=("a" "b" "c" "d" "e" "f"

35
src/esv/esv3/README.md Normal file
View File

@ -0,0 +1,35 @@
## esv
esv is a simple service manager, compatible with sysv init scripts. It is intended to interface well wtith
busybox init, however it also works well with sysvinit.
## Get started
esv requires the following packages:
- Bash (esv runtime)
To install esv, clone the everest-tools repository:
```
git clone https://git.everestlinux.org/EverestLinux/everest-tools
```
Inside `src/esv/esv3`, edit install.conf.dist and ensure all options are adequate, and save as install.conf:
```
EDITOR=your_editor_here
$EDITOR install.conf.dist
```
Run `build.sh` as root:
```
doas ./build.sh install
# OR
sudo ./build.sh install
# OR
su -c ./build.sh install
```
## Usage
```
esv {start,stop,restart} SERVICE_NAME # start a service
esv {-h,--help} # show a help message
esv {-v,--version} # show the version
```

110
src/esv/esv3/esv Executable file
View File

@ -0,0 +1,110 @@
#!/bin/sh
# esv - Everest Service Manager
source /etc/esv.conf
if [ "$?" != "0" ]; then
printf "error while parsing esv config file, does it exist?\n"
exit 1
fi
helpmsg_big() {
printf "${0} - Everest Service Manager\n"
printf "usage: ${0} [start] [stop] [restart] [-h] [-v] SERVICE NAME\n"
printf "\n"
printf "${0} {start} start a service\n"
printf "${0} {stop} stop a service\n"
printf "${0} {restart} restart a running service\n"
printf "${0} {-h/--help} print this message and exit\n"
printf "${0} {-v/--version} print the version and exit\n"
printf "\n"
printf "This program is free software.\n"
printf "See the GNU GPL version 3 for details.\n"
}
helpmsg_small() {
printf "usage: ${0} [start] [stop] [restart] [-h] [-v] SERVICE NAME\n"
}
check_if_exists() {
SV="${@}"
for SRV in ${SV[@]}; do
if [ ! -f "${SRV_DIR}/${SRV}" ]; then
printf "${red}service ${SRV} does not exist${reset}\n"
exit 1
fi
done
}
startsv() {
SV="${@}"
if [ "$SV" = "" ]; then
printf "${red}you must specify a service name${reset}\n"
exit 1
fi
printf "${blue}starting: $SV...${reset}\n"
for SRV in ${SV[@]}; do
source ${SRV}
run
done
}
stopsv() {
SV="${@}"
if [ "$SV" = "" ]; then
printf "${red}you must specify a service name${reset}\n"
exit 1
fi
printf "${blue}stopping: $SV...${reset}\n"
for SRV in ${SV[@]}; do
source ${SRV}
stop
done
}
restartsv() {
SV="${@}"
if [ "$V" = "" ]; then
printf "${red}you must specify a service name${reset}\n"
exit 1
fi
printf "${blue} restarting: $SV...${reset}\n"
for SRV in ${SV[@]}; do
source ${SRV}
restart
done
}
printver() {
printf "${blue}esv v3.0.0${reset}\n"
}
case $1 in
-h|--help)
helpmsg_big
exit 0
;;
-v|--version)
printver
exit 0
;;
start)
shift
check_if_exists "$@"
startsv "$@"
;;
stop)
shift
check_if_exists "$@"
stopsv "$@"
;;
restart)
shift
check_if_exists "$@"
restartsv "$@"
;;
*)
helpmsg_small "$@"
esac

13
src/esv/esv3/esv.conf Executable file
View File

@ -0,0 +1,13 @@
# /etc/esv.conf
# Where services are stored.
# On Everest, this is /etc/init.d
export SRV_DIR="/etc/init.d"
# Colors
export red="\033[1;31m"
export green="\033[1;32m"
export blue="\033[1;34m"
export reset="\033[m"
# end /etc/esv.conf

View File

@ -79,6 +79,8 @@ preload() {
fi
}
preload "$@"
case $1 in
-h|--help)
helpmsg "$@"