use external install script, ask user whether to overwrite the

configuration file.
This commit is contained in:
david 2002-05-25 21:53:00 +00:00
parent 88f2cc719e
commit 9e3c693cf3
2 changed files with 41 additions and 5 deletions

View File

@ -1,13 +1,9 @@
confprefix = /etc
INSTALLCONF = install -p -m 644 --backup=simple
all: build
build:
install: all
$(INSTALLCONF) lampadas.conf $(confprefix)/lampadas.conf
install.sh
clean:

40
LDP/lampadas/conf/install.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
#
# Installs the configuration file
#
confprefix=/etc
INSTALLCONF="install -p -m 644 --backup=simple"
newconf=N
if [ -f $confprefix/lampadas.conf ]; then
echo "Installation will overwrite your configuration file,"
echo "but it will make a backup in lampadas.conf~."
echo ""
echo "Do you want to install a new configuration file? (y/n):"
read newconf
if [ "$newconf" = "y" ]; then
newconf=Y
fi
if [ "$newconf" = "Y" ]; then
doinstall=Y
fi
else
doinstall=Y
fi
if [ "$doinstall" = "Y" ]; then
$INSTALLCONF lampadas.conf $confprefix/lampadas.conf
echo "The configuration file was installed."
if [ "$newconf" = "Y" ]; then
echo "The backup file is /etc/lampadas.conf~."
fi
else
echo "The configuration file was not installed."
fi