Makefile risolve tilde, programma puoi impostare quale programma per su
This commit is contained in:
parent
d0ccb1c16d
commit
77a23bdc41
4
Makefile
4
Makefile
|
@ -2,7 +2,7 @@
|
|||
# See LICENSE file for copyright and license details.
|
||||
|
||||
# paths
|
||||
PREFIX = ~/.local
|
||||
PREFIX = /home/${USER}/.local
|
||||
MANPREFIX = $(PREFIX)/share/man
|
||||
SHELL = bash
|
||||
|
||||
|
@ -19,7 +19,7 @@ install:
|
|||
|
||||
#problema del check: in PATH si trova estesa, qua e' con ~
|
||||
#echo "${PATH}" | grep -q "$(DESTDIR)$(PREFIX)/bin" || echo "$(DESTDIR)$(PREFIX)/bin is not in the PATH variable, ne won't run"
|
||||
|
||||
#(echo ${PATH} | grep -q $(PREFIX)/bin) || echo "$(DESTDIR)$(PREFIX)/bin is not in the PATH variable, ne won't run"
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/ne
|
||||
|
|
10
ne
10
ne
|
@ -9,6 +9,7 @@ usage() {
|
|||
echo "-h -> Show this help"
|
||||
echo "-y -> skip confirm on reload"
|
||||
echo "-c -> manually choose the text editor (default = vim)"
|
||||
echo "Note: ne chooses sudo by default, to change this behaviour update the file ~/.local/share/ne/program_privileges"
|
||||
echo "Default behaviour: without arguments edits nginx.conf with confirmation"
|
||||
exit 0
|
||||
}
|
||||
|
@ -31,7 +32,7 @@ else
|
|||
[[ -e $1 ]] && file=$1 && shift
|
||||
fi
|
||||
[[ $1 = "-y" ]] && shift && skip_confirm=1
|
||||
[[ -e ~/.local/share/ne_auto_confirm ]] && skip_confirm=1 #se flag -y in seconda posizione o esiste ~/.local/share/ne_auto_confirm
|
||||
[[ -e ~/.local/share/ne/settings/auto_confirm ]] && skip_confirm=1 #se flag -y in seconda posizione o esiste ~/.local/share/ne_auto_confirm
|
||||
|
||||
$(which cp) $file /tmp/copia_check_nginx_${USER} #$(which cat) $file > /tmp/copia_check_nginx_${USER} #non so se usare cat > o cp
|
||||
#se cat > o cp danno errore vuol dire che il file non esiste ed esco male:
|
||||
|
@ -50,14 +51,15 @@ then
|
|||
fi
|
||||
|
||||
[[ -e $(which $text_editor) ]] || exit 3
|
||||
sudo $text_editor $file
|
||||
[[ -e ~/.local/share/ne/settings/program_privileges ]] && program_privileges=$(cat ~/.local/share/ne/settings/program_privileges) || program_privileges=sudo
|
||||
$program_privileges $text_editor $file
|
||||
diff --color=always $file /tmp/copia_check_nginx_${USER}
|
||||
|
||||
edited=$?
|
||||
if [[ $edited = 1 ]]
|
||||
then
|
||||
sudo nginx -t || exit 1
|
||||
[[ $skip_confirm = 1 ]] && sudo nginx -s reload || confirm "Configuration OK, reload conf? " && sudo nginx -s reload && echo "nginx should be updated" || echo "Aborted"
|
||||
$program_privileges nginx -t || exit 1
|
||||
[[ $skip_confirm = 1 ]] && $program_privileges nginx -s reload || confirm "Configuration OK, reload conf? " && $program_privileges nginx -s reload && echo "nginx should be updated" || echo "Aborted"
|
||||
else
|
||||
echo "No edits found, no need for nginx reload"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user