init: offer copy config only for new installations

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-26 13:02:04 +01:00
parent bc414eef5a
commit 08a05242f9

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing
# 10 - not bash!
#
#### $$VERSION$$ v1.35-dev-12-g47cab80
#### $$VERSION$$ v1.35-dev-13-gbc414ee
##################################################################
# emmbeded system may claim bash but it is not
@ -1137,11 +1137,12 @@ bot_init() {
printf "Mycommands.sh not found, copy ${GREY}mycommands.sh.dist${NC} to mycommands.sh? (y/N) N\b"
read -r ANSWER
[[ "${ANSWER}" =~ ^[Yy] ]] && cp -f "${BASHBOT_ETC:-.}/mycommands.sh.dist" "${BASHBOT_ETC:-.}/mycommands.sh"
fi
if [ ! -r "${BASHBOT_ETC:-.}/mycommands.conf" ]; then
printf "Mycommands config file not found, copy ${GREY}mycommands.conf.dist${NC} to mycommands.conf? (y/N) N\b"
read -r ANSWER
[[ "${ANSWER}" =~ ^[Yy] ]] && cp -f "${BASHBOT_ETC:-.}/mycommands.conf.dist" "${BASHBOT_ETC:-.}/mycommands.conf"
# offer to copy config also
if [ ! -r "${BASHBOT_ETC:-.}/mycommands.conf" ]; then
printf "Mycommands config file not found, copy ${GREY}mycommands.conf.dist${NC} to mycommands.conf? (y/N) N\b"
read -r ANSWER
[[ "${ANSWER}" =~ ^[Yy] ]] && cp -f "${BASHBOT_ETC:-.}/mycommands.conf.dist" "${BASHBOT_ETC:-.}/mycommands.conf"
fi
fi
# adjust permissions
printf "Adjusting files and permissions for user \"${touser}\" ...\n"