1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yourls_ynh.git synced 2024-09-03 20:35:59 +02:00
yourls_ynh/scripts/install

33 lines
777 B
Text
Raw Normal View History

2014-06-12 13:28:57 +02:00
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a yourls
if [[ ! $? -eq 0 ]]; then
exit 1
fi
2014-06-12 18:16:54 +02:00
# Generate random password
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
# Use 'yourls' as database name and user
db_user=yourls
# Initialize database and store mysql password for upgrade
sudo yunohost app initdb $db_user -p $db_pwd
sudo yunohost app setting yourls mysqlpwd -v $db_pwd
2014-06-12 13:28:57 +02:00
# Copy files to the right place
final_path=/var/www/yourls
sudo mkdir -p $final_path
2014-06-12 18:16:54 +02:00
sudo cp -a ../sources/* $final_path
sudo cp $final_path/user/config-sample.php $final_path/user/config.php
2014-06-12 13:28:57 +02:00
# Set permissions
2014-06-12 18:16:54 +02:00
sudo chown -R www-data: $final_path