Make installer idempotent
This commit is contained in:
parent
deccb92ae0
commit
6a560e460a
28
install.sh
28
install.sh
@ -5,26 +5,21 @@
|
|||||||
echo "Installing dependencies..."
|
echo "Installing dependencies..."
|
||||||
apk add lighttpd curl jq bash youtube-dl ffmpeg
|
apk add lighttpd curl jq bash youtube-dl ffmpeg
|
||||||
|
|
||||||
read -p "Please enter your bot token: " token
|
if [ ! -f /etc/konata.conf ]
|
||||||
read -p "Please enter the bot's username (without @): " bot
|
|
||||||
read -p "Please enter the domain for your bot: " domain
|
|
||||||
read -p "Do you want to use a log chat? (y/n): " logans
|
|
||||||
[ ! -z $logans ] && read -p "What's the log chat's chat ID? " logchat
|
|
||||||
|
|
||||||
if [ -f /etc/konata.conf ]
|
|
||||||
then
|
then
|
||||||
read -p "/etc/konata.conf already exists. Do you want to remove it? (y/n) " ans
|
echo "Configuring bot..."
|
||||||
if [ "$ans" == "y" ]
|
read -p "Please enter your bot token: " token
|
||||||
then
|
read -p "Please enter the bot's username (without @): " bot
|
||||||
rm /etc/konata.conf
|
read -p "Please enter the domain for your bot: " domain
|
||||||
else
|
read -p "Do you want to use a log chat? (y/n): " logans
|
||||||
echo "Keeping file. Please investigate this file and run the installer again."
|
[ "$logans" == "y" ] && read -p "What's the log chat's chat ID? " logchat
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "token=$token" >> /etc/konata.conf
|
echo "token=$token" >> /etc/konata.conf
|
||||||
echo "bot=$bot" >> /etc/konata.conf
|
echo "bot=$bot" >> /etc/konata.conf
|
||||||
|
echo "domain=$domain" >> /etc/konata.conf
|
||||||
[ ! -z $logchat ] && echo "logchat=$logchat" >> /etc/konata.conf
|
[ ! -z $logchat ] && echo "logchat=$logchat" >> /etc/konata.conf
|
||||||
|
else
|
||||||
|
. /etc/konata.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing application files..."
|
echo "Installing application files..."
|
||||||
@ -32,6 +27,7 @@ install -m644 lighttpd.conf /etc/lighttpd/lighttpd.conf
|
|||||||
mkdir /var/www/konata
|
mkdir /var/www/konata
|
||||||
rand=$RANDOM
|
rand=$RANDOM
|
||||||
install -m755 konata.sh /usr/local/bin/konata
|
install -m755 konata.sh /usr/local/bin/konata
|
||||||
|
rm /var/www/konata/*.sh
|
||||||
ln -s /usr/local/bin/konata /var/www/konata/$rand.sh
|
ln -s /usr/local/bin/konata /var/www/konata/$rand.sh
|
||||||
install -m644 index.html /var/www/konata/index.html
|
install -m644 index.html /var/www/konata/index.html
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user