mirror of
https://github.com/YunoHost-Apps/kiwiirc_ynh.git
synced 2024-09-03 19:35:59 +02:00
[enh] implement upgrade script
This commit is contained in:
parent
8ebd9176fd
commit
c0aba5c4e2
2 changed files with 69 additions and 3 deletions
|
@ -18,7 +18,7 @@ sudo apt-get install nodejs-legacy npm -y
|
||||||
version=de1607bf1e9ba4429a10f895a6ec45c54daa3161
|
version=de1607bf1e9ba4429a10f895a6ec45c54daa3161
|
||||||
echo "Downloading KiwiIRC $version..."
|
echo "Downloading KiwiIRC $version..."
|
||||||
mkdir ../tmp
|
mkdir ../tmp
|
||||||
sudo wget -O ../tmp/kiwiirc-$version.tar.gz "https://github.com/prawnsalad/KiwiIRC/archive/de1607bf1e9ba4429a10f895a6ec45c54daa3161.tar.gz"
|
sudo wget -O ../tmp/kiwiirc-$version.tar.gz "https://github.com/prawnsalad/KiwiIRC/archive/$version.tar.gz"
|
||||||
|
|
||||||
echo "Deploying source files..."
|
echo "Deploying source files..."
|
||||||
cd ../tmp && tar xvzf ../tmp/kiwiirc-$version.tar.gz && cd ../scripts
|
cd ../tmp && tar xvzf ../tmp/kiwiirc-$version.tar.gz && cd ../scripts
|
||||||
|
|
|
@ -1,4 +1,70 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "TODO"
|
# Retrieve arguments
|
||||||
exit 1
|
domain=$(sudo yunohost app setting kiwiirc domain)
|
||||||
|
path=$(sudo yunohost app setting kiwiirc path)
|
||||||
|
is_public=$(sudo yunohost app setting kiwiirc is_public)
|
||||||
|
|
||||||
|
sudo service ynh-kiwiirc stop
|
||||||
|
sudo update-rc.d ynh-kiwiirc remove
|
||||||
|
sudo yunohost service remove ynh-kiwiirc
|
||||||
|
|
||||||
|
version=de1607bf1e9ba4429a10f895a6ec45c54daa3161
|
||||||
|
echo "Downloading KiwiIRC $version..."
|
||||||
|
mkdir ../tmp
|
||||||
|
sudo wget -O ../tmp/kiwiirc-$version.tar.gz "https://github.com/prawnsalad/KiwiIRC/archive/$version.tar.gz"
|
||||||
|
|
||||||
|
echo "Deploying source files..."
|
||||||
|
cd ../tmp && tar xvzf ../tmp/kiwiirc-$version.tar.gz && cd ../scripts
|
||||||
|
final_path=/var/www/kiwiirc
|
||||||
|
sudo rm -rf $final_path/*
|
||||||
|
|
||||||
|
sudo cp -r ../tmp/KiwiIRC-$version/* $final_path
|
||||||
|
#sudo cp ../conf/npm-shrinkwrap.json $final_path
|
||||||
|
sudo chown -R kiwiirc: $final_path
|
||||||
|
|
||||||
|
echo "Installing KiwiIRC with NPM..."
|
||||||
|
sudo su --shell /bin/bash --command "cd $final_path && npm install --production --registry http://registry.npmjs.org" kiwiirc
|
||||||
|
|
||||||
|
echo "Cleaning up install tree..."
|
||||||
|
sudo rm -rf $final_path/.npm
|
||||||
|
|
||||||
|
echo "Deploying configuration..."
|
||||||
|
sed -i "s@YNH_BASE_PATH@${path}@g" ../conf/config.js
|
||||||
|
sudo cp ../conf/config.js $final_path/config.js
|
||||||
|
sudo chown kiwiirc: $final_path/config.js
|
||||||
|
sudo chmod 644 $final_path/config.js
|
||||||
|
|
||||||
|
echo "Post install step... building client side"
|
||||||
|
sudo su --shell /bin/bash --command "cd $final_path && node $final_path/server/server.js build" kiwiirc
|
||||||
|
|
||||||
|
echo "Setting up init script..."
|
||||||
|
logfile=/var/log/ynh-kiwiirc.log
|
||||||
|
sudo touch $logfile
|
||||||
|
sudo chown kiwiirc: $logfile
|
||||||
|
sed -i "s@YNH_FINALPATH@$final_path@g" ../conf/init-script
|
||||||
|
sed -i "s@YNH_LOGFILE@$logfile@g" ../conf/init-script
|
||||||
|
sudo cp ../conf/init-script /etc/init.d/ynh-kiwiirc
|
||||||
|
sudo chmod +x /etc/init.d/ynh-kiwiirc
|
||||||
|
sudo update-rc.d ynh-kiwiirc defaults
|
||||||
|
sudo service ynh-kiwiirc start
|
||||||
|
sudo yunohost service add ynh-kiwiirc -l $logfile
|
||||||
|
|
||||||
|
echo "Setting up logrotate configuration..."
|
||||||
|
sed -i "s@YNH_LOGFILE@$logfile@g" ../conf/logrotate
|
||||||
|
sudo cp ../conf/logrotate /etc/logrotate.d/ynh-kiwiirc
|
||||||
|
|
||||||
|
echo "Nginx configuration..."
|
||||||
|
sed -i "s@YNH_LOCATION@$path@g" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/kiwiirc.conf
|
||||||
|
|
||||||
|
if [ $is_public = "Yes" ]; then
|
||||||
|
sudo yunohost app setting kiwiirc skipped_uris -v "/"
|
||||||
|
fi
|
||||||
|
sudo yunohost app setting kiwiirc is_public -v $is_public
|
||||||
|
|
||||||
|
echo "Reloading Nginx (sso enabled)..."
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
|
echo "Success !"
|
||||||
|
|
Loading…
Reference in a new issue