mirror of
https://github.com/openwall/lkrg.git
synced 2023-12-13 21:30:29 +01:00
scripts: double-quote variables and expansions, copy file with archive mode
This commit is contained in:
parent
ffdc3c62c2
commit
b42ef9c1d5
1 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
# - Adam 'pi3' Zabrocki (http://pi3.com.pl)
|
||||
##
|
||||
|
||||
P_SYSTEMD_DIR=`systemctl show -p UnitPath | cut -d " " -f5`
|
||||
P_SYSTEMD_DIR="$(systemctl show -p UnitPath | cut -d " " -f5)"
|
||||
|
||||
case "$P_SYSTEMD_DIR" in
|
||||
\/run/*) P_SYSTEMD_DIR=/etc/systemd/system ;;
|
||||
|
@ -22,12 +22,12 @@ P_NC='\033[0m' # No Color
|
|||
echo -e " ${P_GREEN}[+] ${P_WHITE}Systemd detected${P_NC}"
|
||||
|
||||
if [ "$1" == "install" ]; then
|
||||
if [ -f $P_SYSTEMD_DIR/lkrg.service ]; then
|
||||
if [ -f "$P_SYSTEMD_DIR/lkrg.service" ]; then
|
||||
echo -e " ${P_RED}ERROR! ${P_YL}lkrg.service${P_RED} file already exists under ${P_YL}$P_SYSTEMD_DIR${P_RED} folder${P_NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e " ${P_GREEN}Installing ${P_YL}lkrg.service${P_GREEN} file under ${P_YL}$P_SYSTEMD_DIR${P_GREEN} folder${P_NC}"
|
||||
cp scripts/bootup/systemd/lkrg.service $P_SYSTEMD_DIR/lkrg.service
|
||||
cp -a scripts/bootup/systemd/lkrg.service "$P_SYSTEMD_DIR/lkrg.service"
|
||||
echo -e " ${P_GREEN}Enabling ${P_YL}lkrg.service${P_GREEN} on bootup${P_NC}"
|
||||
systemctl enable lkrg.service
|
||||
echo -e " ${P_GREEN}To start ${P_YL}lkrg.service${P_GREEN} please use: ${P_YL}systemctl start lkrg${P_NC}"
|
||||
|
@ -38,7 +38,7 @@ elif [ "$1" == "uninstall" ]; then
|
|||
echo -e " ${P_GREEN}Disabling ${P_YL}lkrg.service${P_GREEN} on bootup${P_NC}"
|
||||
systemctl disable lkrg.service
|
||||
echo -e " ${P_GREEN}Deleting ${P_YL}lkrg.service${P_GREEN} file from the ${P_YL}$P_SYSTEMD_DIR${P_GREEN} folder${P_NC}"
|
||||
rm $P_SYSTEMD_DIR/lkrg.service
|
||||
rm "$P_SYSTEMD_DIR/lkrg.service"
|
||||
else
|
||||
echo -e " ${P_RED}ERROR! Unknown option!${P_NC}"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in a new issue