emk v1.0.0
This commit is contained in:
parent
3599dc7f76
commit
576f0f0580
52
src/emk/build.sh
Executable file
52
src/emk/build.sh
Executable 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
|
@ -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"
|
||||||
|
@ -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
0
src/emk/emkfile.template
Normal file → Executable file
10
src/emk/install.conf.def
Executable file
10
src/emk/install.conf.def
Executable 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"
|
Loading…
Reference in New Issue
Block a user