emk v1.0.0

This commit is contained in:
lw-everestlinux 2022-11-28 11:05:17 -05:00
parent 3599dc7f76
commit 576f0f0580
5 changed files with 65 additions and 0 deletions

52
src/emk/build.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
WORKING_DIR=$(pwd)
printf "parsing install.conf...\n"
. $(pwd)/install.conf
if [ "$?" != 0 ]; then
printf "install.conf not found\n"
exit 1
else
printf "install.conf found, loading settings...\n"
fi
am_i_root() {
printf "checking if user is root...\n"
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "you are not root, aborting...\n"
exit 1
else
printf "you are root\n"
fi
}
install_emk() {
mv -v $WORKING_DIR/emk.conf $CONFDIR
mv -v $WORKING_DIR/emk $PREFIX/bin || mv -v $WORKING_DIR/emk $PREFIX
}
uninstall_emk() {
rm -v $PREFIX/bin/emk || rm -v $PREFIX/emk
rm -v $CONFDIR/emk.conf
}
case $1 in
install)
am_i_root "$@"
install_emk "$@"
;;
update)
am_i_root "$@"
uninstall_emk "$@"
install_emk "$@"
;;
uninstall)
am_i_root "$@"
uninstall_emk "$@"
;;
*)
am_i_root "$@"
printf "no tasks to be done for ${2}\n"
exit 1
esac

View File

@ -16,6 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
#. /etc/emk.conf #. /etc/emk.conf
. $(pwd)/emk.conf
am_i_root() { am_i_root() {
if [[ $(/usr/bin/id -u) -ne 0 ]]; then if [[ $(/usr/bin/id -u) -ne 0 ]]; then
@ -53,6 +54,7 @@ case $1 in
fi fi
;; ;;
*) *)
am_i_root "$@"
./emkfile $2 ./emkfile $2
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
printf "emk ${red}ERR${reset} | subproccess finished with non-zero status.\n" printf "emk ${red}ERR${reset} | subproccess finished with non-zero status.\n"

View File

@ -5,5 +5,6 @@ export red="\033[1;31m"
export green="\033[1;32m" export green="\033[1;32m"
export blue="\033[1;34m" export blue="\033[1;34m"
export reset="\033[m" export reset="\033[m"
export yellow="\033[1;33m"
# end /etc/emk.conf # end /etc/emk.conf

0
src/emk/emkfile.template Normal file → Executable file
View File

10
src/emk/install.conf.def Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# install.conf
# Installation prefix
# On Everest, this should be /usr, because /bin, /sbin, and /lib are all symlinks to /usr
PREFIX="/usr"
# System config directory
# On almost all systems, this should be /etc
CONFDIR="/etc"