before install/remove check if user is root

final fixups for our custom make system
parent 27fe05f7
......@@ -18,7 +18,7 @@ export_result ()
echo -e "MODE=\"$MODE\"\
\nPREFIX=\"$PREFIX\"\
\nDATADIR=\"$PREFIX/share/bashstyle-ng/\"\
\nDATADIR_LIST=( code data rc/{,ascii,bin,dirinfo,functions,internal,settings,styles,wizard} terminfo/{,b,m,n} vim/{,colors} )\
\nDATADIR_LIST=( code data rc/{,ascii,bin,dirinfo,functions,generator,internal,settings,styles,wizard} terminfo/{,b,m,n} vim/{,colors} )\
\nPROFILEDIR=\"/etc/profile.d/\"\
\nBINDIR=\"$PREFIX/bin\"\
\nLOCALEDIR=\"$PREFIX/share/locale/\"\
......
#!/bin/bash
DATA_FILES=( code/bsng.py:${DATADIR}/code
code/undobuffer.py:${DATADIR}/code
data/bashstyle7.ui:${DATADIR}/data
rc/nx-rc:${DATADIR}/rc
rc/ascii/*:${DATADIR}/rc/ascii
......@@ -10,6 +11,7 @@ DATA_FILES=( code/bsng.py:${DATADIR}/code
rc/settings/*:${DATADIR}/rc/settings
rc/styles/*:${DATADIR}/rc/styles
rc/wizard/*:${DATADIR}/rc/wizard
rc/generator/*:${DATADIR}/rc/generator
data/terminfo/b/*:${DATADIR}/terminfo/b
data/terminfo/m/*:${DATADIR}/terminfo/m
data/terminfo/n/*:${DATADIR}/terminfo/n
......
......@@ -27,7 +27,8 @@ inst ()
uninst ()
{
FILE=${1/:*}
xFILE=${1/:*}
FILE=${xFILE/*\/}
DEST=${1/*:}
rm -f ${DESTDIR}${DEST}/${FILE}
......
......@@ -30,24 +30,24 @@ installdirs_remove ()
{
echo -e "${RED}Removing directories."
rmdir --ignore-fail-on-non-empty $DESTDIR/$DATADIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$DATADIR
for directory in ${DATADIR_LIST[@]}; do
rmdir --ignore-fail-on-non-empty $DESTDIR/$DATADIR/$directory
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$DATADIR/$directory
done
rmdir --ignore-fail-on-non-empty $DESTDIR/$LOCALEDIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$LOCALEDIR
for directory in ${LOCALEDIR_LIST[@]}; do
rmdir --ignore-fail-on-non-empty $DESTDIR/$LOCALEDIR/$directory/
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$LOCALEDIR/$directory/
done
rmdir --ignore-fail-on-non-empty $DESTDIR/$DOCDIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$DOCDIR
for directory in ${DOCDIR_LIST[@]}; do
rmdir --ignore-fail-on-non-empty $DESTDIR/$DOCDIR/$directory
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$DOCDIR/$directory
done
rmdir --ignore-fail-on-non-empty $DESTDIR/$BINDIR
rmdir --ignore-fail-on-non-empty $DESTDIR/$PROFILEDIR
rmdir --ignore-fail-on-non-empty $DESTDIR/$ICONDIR
rmdir --ignore-fail-on-non-empty $DESTDIR/$PCDIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$BINDIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$PROFILEDIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$ICONDIR
rmdir -p --ignore-fail-on-non-empty $DESTDIR/$PCDIR
}
......@@ -32,12 +32,20 @@ case $1 in
export ) git_export $HOME/Desktop/bashstyle-ng-$2 ;;
install ) if [[ -e $PWD/.make/build_done ]]; then
install ) if [[ $EUID != 0 ]]; then
echo -e "\n${RED}You're not root!\n"
exit 1
fi
if [[ -e $PWD/.make/build_done ]]; then
installdirs_create && install_bsng && post_install
else echo -e "\n${RED}You need to run ./make all first!\n"
fi ;;
remove ) pre_remove && remove_bsng && installdirs_remove ;;
remove ) if [[ $EUID != 0 ]]; then
echo -e "\n${RED}You're not root!\n"
exit 1
fi
pre_remove && remove_bsng && installdirs_remove ;;
changelog ) $PWD/.make/changelog ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment