mirror of
https://github.com/YunoHost-Apps/shaarli_ynh.git
synced 2024-09-03 20:26:10 +02:00
Merge pull request #24 from rokaz/install_script
Install script update, adding configuration and possibility to have a private instance
This commit is contained in:
commit
fbd2fd4ae8
16 changed files with 216 additions and 160 deletions
11
README.md
11
README.md
|
@ -17,10 +17,17 @@ Help for dev/testing hightly appreciated :)
|
|||
* Backup/restore scripts
|
||||
* Adding / removing a link
|
||||
* Upgrade *not tested*
|
||||
* Configure Shaarli during installation
|
||||
|
||||
## Installation information
|
||||
|
||||
When doing the installation you will be prompted if you want to have a public site, meaning that you don't have to be a user of this Yunohost instance to access the site.
|
||||
|
||||
You will also be asked if you want to have a private instance, meaning that the authentication will be deactivated and the application will be only available to the owner designed during install.
|
||||
|
||||
## TODO
|
||||
|
||||
* Configure Shaarli during installation
|
||||
|
||||
* Integrate the ssowat authentication (currently the authentication is done by Shaarli)
|
||||
* Test more the package
|
||||
|
||||
## Changelog
|
||||
|
|
60
conf/config.json.php
Normal file
60
conf/config.json.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php /*
|
||||
{
|
||||
"resource": {
|
||||
"data_dir": "data",
|
||||
"config": "data\/config.php",
|
||||
"datastore": "data\/datastore.php",
|
||||
"ban_file": "data\/ipbans.php",
|
||||
"updates": "data\/updates.txt",
|
||||
"log": "data\/log.txt",
|
||||
"update_check": "data\/lastupdatecheck.txt",
|
||||
"raintpl_tpl": "tpl\/",
|
||||
"raintpl_tmp": "tmp\/",
|
||||
"thumbnails_cache": "cache",
|
||||
"page_cache": "pagecache"
|
||||
},
|
||||
"security": {
|
||||
"ban_after": 4,
|
||||
"ban_duration": 1800,
|
||||
"session_protection_disabled": false,
|
||||
"open_shaarli": false
|
||||
},
|
||||
"general": {
|
||||
"header_link": "?",
|
||||
"links_per_page": 20,
|
||||
"enabled_plugins": [
|
||||
"qrcode"
|
||||
],
|
||||
"timezone": "YNH_TIMEZONE",
|
||||
"title": "YNH_TITLE"
|
||||
},
|
||||
"updates": {
|
||||
"check_updates": true,
|
||||
"check_updates_branch": "stable",
|
||||
"check_updates_interval": 86400
|
||||
},
|
||||
"feed": {
|
||||
"rss_permalinks": true,
|
||||
"show_atom": false
|
||||
},
|
||||
"privacy": {
|
||||
"default_private_links": YNH_PRIVATE_LINK_BY_DEFAULT,
|
||||
"hide_public_links": false,
|
||||
"hide_timestamps": false
|
||||
},
|
||||
"thumbnail": {
|
||||
"enable_thumbnails": true,
|
||||
"enable_localcache": true
|
||||
},
|
||||
"redirector": {
|
||||
"url": "",
|
||||
"encode_url": true
|
||||
},
|
||||
"plugins": [],
|
||||
"credentials": {
|
||||
"login": "YNH_ADMIN",
|
||||
"salt": "YNH_SALT",
|
||||
"hash": "YNH_HASH"
|
||||
}
|
||||
}
|
||||
*/ ?>
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
$GLOBALS['salt'] = 'YNH_SALT';
|
||||
$GLOBALS['timezone'] = 'YNH_TIMEZONE';
|
||||
date_default_timezone_set('YNH_TIMEZONE');
|
||||
$GLOBALS['title'] = 'YNH_TITLE';
|
||||
$GLOBALS['redirector'] = '';
|
||||
$GLOBALS['disablesessionprotection'] = false;
|
||||
$GLOBALS['disablejquery'] = false;
|
||||
$GLOBALS['privateLinkByDefault'] = 'YNH_PRIVATE_LINK_BY_DEFAULT';
|
||||
$GLOBALS['ynh_admin'] = 'YNH_ADMIN';
|
||||
|
||||
require(realpath(dirname(__FILE__)) . '/config_user.php');
|
||||
?>
|
1
conf/datastore.php
Normal file
1
conf/datastore.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php /* tVPJbtswEL3nKyYq0F5sSbYcLzSKAnEPDdDATeygSS8BJY0t1hSpkJRTJ/C/dyg5LRqkly6EDuRoljfz3nDWZ4+CxVPOJuzR0isQeTAVrDe17IQFTjiJAd1H9IBFwbmRgoErECo0VisuO1AKJUouhXUdsDXZuyvu70p3c+54yi1CjlJkQtcWMqlVkzJhQW1kc5uwoHCusiyK1sIVdRpmuoxsWy46lI3uxUZ4916PBTnazIjKCa2aDDHZPqOkMASnn5Aew7IQFujb6drAShjroKpTwgKp1puSm00ISw2YCwfaeJjoEErs+Agoa/Jvo6ReCxUeHZGzRG4UFPreV6qpuUO1DmRa2Vq6Zj5SqA28vqu1m35AWUW5zuoSleMec2sH3rqm2jldgl7Ri7BWfI1U6YYA+Ozeg/oqayXczg+40sZhDlsigFK1YUjoBSHk8gkNVEZ/xYx4SHewQGLBCVSw4PXW529IZUFlxJY79JTHrSUzSAYSwZyNWfCe7ktRYkB0kT4GNPnGnaQyZEE/7o26cb/bHwKRQpZBEsbNaXhKvIBKfCDCb92uaqok9GP8034QwtVyFkz3TX7H17aJJlHoCpUl5jIEq1funpsmgOJtQUM4yIeAnIu+mq0P/6gBefsn0tp73T/fhPjZJiQE95x4QBqUA+vq1SoMQ+jCJ5owpiQSKvCrvidxC4IwWEztgQGFLqp8TPRuPEgGaX80SYZZPBkOJq/Sy9G1vS70UnzM7mbVRVrOq1ORmLv+w8PF1eykOD0bfVn25sm38dvfrMSQxrIo6BzD2ZsSOByoboWpldzBzfwKMq6oFwzBy80/fqwAqVu/IJPeX8vk5J/KhDpvuWioeFkew8HZZfqSPP43M/v9dw== */ ?>
|
7
conf/gen_hash.php
Normal file
7
conf/gen_hash.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
echo sha1($argv[1].$argv[2].$argv[3]);
|
||||
|
||||
?>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
$GLOBALS['salt'] = 'YNH_SALT';
|
||||
$GLOBALS['timezone'] = 'YNH_TIMEZONE';
|
||||
date_default_timezone_set('YNH_TIMEZONE');
|
||||
$GLOBALS['title'] = 'YNH_TITLE';
|
||||
$GLOBALS['redirector'] = '';
|
||||
$GLOBALS['disablesessionprotection'] = false;
|
||||
$GLOBALS['disablejquery'] = false;
|
||||
$GLOBALS['privateLinkByDefault'] = YNH_PRIVATE_LINK_BY_DEFAULT;
|
||||
$GLOBALS['ynh_admin'] = 'YNH_ADMIN';
|
||||
|
||||
$userconfigfile = realpath(dirname(__FILE__)) . '/config_user.php';
|
||||
if (is_file($userconfigfile))
|
||||
{
|
||||
require($userconfigfile);
|
||||
}
|
||||
?>
|
|
@ -1,52 +0,0 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
require('/home/yunohost.app/shaarli/data/config.php');
|
||||
|
||||
$userlist=$argv;
|
||||
array_shift($userlist);
|
||||
|
||||
foreach($userlist as $usercount => $userlogin)
|
||||
{
|
||||
$userlevel = '2';
|
||||
if ($userlogin == $GLOBALS['ynh_admin'])
|
||||
{
|
||||
$userlevel = '4';
|
||||
}
|
||||
|
||||
$currentLogin = array($userlogin);
|
||||
$currentPassword = array($userlogin => '');
|
||||
$currentLevel = array($userlogin => $userlevel);
|
||||
$currentEmail = array($userlogin => '');
|
||||
|
||||
if (array_key_exists('login', $GLOBALS))
|
||||
{
|
||||
$GLOBALS['login'] = array_merge($GLOBALS['login'], $currentLogin);
|
||||
$GLOBALS['password'] = array_merge($GLOBALS['password'], $currentPassword);
|
||||
$GLOBALS['level'] = array_merge($GLOBALS['level'], $currentLevel);
|
||||
$GLOBALS['email'] = array_merge($GLOBALS['email'], $currentEmail);
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['login'] = $currentLogin;
|
||||
$GLOBALS['password'] = $currentPassword;
|
||||
$GLOBALS['level'] = $currentLevel;
|
||||
$GLOBALS['email'] = $currentEmail;
|
||||
}
|
||||
}
|
||||
|
||||
$userconf = '<?php' . PHP_EOL;
|
||||
$userconf .= '$GLOBALS[\'login\'] = ' . var_export($GLOBALS['login'],true) . ';' . PHP_EOL;
|
||||
$userconf .= '$GLOBALS[\'password\'] = ' . var_export($GLOBALS['password'],true) . ';' . PHP_EOL;
|
||||
$userconf .= '$GLOBALS[\'level\'] = ' . var_export($GLOBALS['level'],true) . ';' . PHP_EOL;
|
||||
$userconf .= '$GLOBALS[\'email\'] = ' . var_export($GLOBALS['email'],true) . ';' . PHP_EOL;
|
||||
$userconf .= '?>';
|
||||
|
||||
$userconf_file = '/home/yunohost.app/shaarli/data/config_user.php';
|
||||
if (!file_put_contents($userconf_file, $userconf) || strcmp(file_get_contents($userconf_file),$userconf)!=0)
|
||||
{
|
||||
fwrite(STDERR, "Error while writing " . $userconf_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
?>
|
10
conf/ipbans.php
Normal file
10
conf/ipbans.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
$GLOBALS['IPBANS']=array (
|
||||
'FAILURES' =>
|
||||
array (
|
||||
),
|
||||
'BANS' =>
|
||||
array (
|
||||
),
|
||||
);
|
||||
?>
|
1
conf/lastupdatecheck.txt
Normal file
1
conf/lastupdatecheck.txt
Normal file
|
@ -0,0 +1 @@
|
|||
0.7.0 */
|
0
conf/log.txt
Normal file
0
conf/log.txt
Normal file
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* DATADIR is defined in index.php, and cannot be defined elsewhere
|
||||
*
|
||||
$GLOBALS['config']['DATADIR'] = '/home/yunohost.app/shaarli/data'; // Data subdirectory
|
||||
*/
|
||||
$GLOBALS['config']['CONFIG_FILE'] = $GLOBALS['config']['DATADIR'].'/config.php'; // Configuration file (user login/password)
|
||||
$GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php'; // Data storage file.
|
||||
$GLOBALS['config']['LINKS_PER_PAGE'] = 20; // Default links per page.
|
||||
$GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; // File storage for failures and bans.
|
||||
$GLOBALS['config']['BAN_AFTER'] = 4; // Ban IP after this many failures.
|
||||
$GLOBALS['config']['BAN_DURATION'] = 1800; // Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes)
|
||||
$GLOBALS['config']['OPEN_SHAARLI'] = false; // If true, anyone can add/edit/delete links without having to login
|
||||
$GLOBALS['config']['HIDE_TIMESTAMPS'] = false; // If true, the moment when links were saved are not shown to users that are not logged in.
|
||||
$GLOBALS['config']['HIDE_QRCODE'] = false; // If true, qrcodes are not shown.
|
||||
$GLOBALS['config']['ENABLE_THUMBNAILS'] = true; // Enable thumbnails in links.
|
||||
$GLOBALS['config']['CACHEDIR'] = '/home/yunohost.app/shaarli/cache'; // Cache directory for thumbnails for SLOW services (like flickr)
|
||||
$GLOBALS['config']['PAGECACHE'] = '/home/yunohost.app/shaarli/pagecache'; // Page cache directory.
|
||||
$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage.
|
||||
$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable.
|
||||
$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; // For updates check of Shaarli.
|
||||
$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours
|
||||
$GLOBALS['config']['RTP_TMPDIR'] = '/home/yunohost.app/shaarli/tmp'; // Rain template tmp directory.
|
1
conf/updates.txt
Normal file
1
conf/updates.txt
Normal file
|
@ -0,0 +1 @@
|
|||
updateMethodMergeDeprecatedConfigFile;updateMethodRenameDashTags;updateMethodConfigToJson;updateMethodEscapeUnescapedConfig;updateMethodDatastoreIds
|
|
@ -1,3 +0,0 @@
|
|||
import sys, json
|
||||
userlist=json.loads(sys.stdin.readlines()[0])["users"]
|
||||
print "{0}".format("\n".join(i["username"] for i in userlist.values()))
|
|
@ -2,6 +2,9 @@
|
|||
"name": "Shaarli",
|
||||
"id": "shaarli",
|
||||
"packaging_format": 1,
|
||||
"requirements": {
|
||||
"yunohost": ">> 2.3.15"
|
||||
},
|
||||
"description": {
|
||||
"en": "The personal, minimalist, super-fast, no-database delicious clone",
|
||||
"fr": "Clone de delicious, rapide, simple et sans base de données."
|
||||
|
@ -10,12 +13,14 @@
|
|||
"name": "Lapineige"
|
||||
},
|
||||
"url": "https://github.com/shaarli/Shaarli",
|
||||
"license": "free",
|
||||
"version": "0.8.3",
|
||||
"multi_instance": "false",
|
||||
"multi_instance": "true",
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for your Shaarli",
|
||||
"fr": "Choisissez un domaine pour votre Shaarli"
|
||||
|
@ -24,6 +29,7 @@
|
|||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for your Shaarli",
|
||||
"fr": "Choisissez un chemin pour votre Shaarli"
|
||||
|
@ -32,7 +38,7 @@
|
|||
"default": "/shaarli"
|
||||
},
|
||||
{
|
||||
"name": "public",
|
||||
"name": "is_public",
|
||||
"ask": {
|
||||
"en": "Is it a public Shaarli site ?",
|
||||
"fr": "Est-ce un site Shaarli public ?"
|
||||
|
@ -40,15 +46,6 @@
|
|||
"choices": ["Yes", "No"],
|
||||
"default": "No"
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"ask": {
|
||||
"en": "Choose a title for Shaarli's page",
|
||||
"fr": "Choissez un titre pour la page Shaarli"
|
||||
},
|
||||
"example": "Shaarli",
|
||||
"default": "Shaarli"
|
||||
},
|
||||
{
|
||||
"name": "privatelinkbydefault",
|
||||
"ask": {
|
||||
|
@ -59,12 +56,39 @@
|
|||
"default": "Yes"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"name": "privateinstance",
|
||||
"ask": {
|
||||
"en": "Admin user",
|
||||
"fr": "Administrateur"
|
||||
"en": "Is this instance private?",
|
||||
"fr": "Cette instance est-elle privée ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Owner of the Shaarli instance",
|
||||
"fr": "Propriétaire de l'instance Shaarli"
|
||||
},
|
||||
"example": "test"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Define password for Shaarli user",
|
||||
"fr": "Définissez le mot de passe de l'utilisateur Shaarli"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"ask": {
|
||||
"en": "Choose a title for Shaarli's page",
|
||||
"fr": "Choissez un titre pour la page Shaarli"
|
||||
},
|
||||
"example": "Shaarli",
|
||||
"default": "Shaarli"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
104
scripts/install
104
scripts/install
|
@ -1,26 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||
set -e
|
||||
|
||||
# This is a multi-instance app, meaning it can be installed several times independently
|
||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
||||
# The app instance name is available as $YNH_APP_INSTANCE_NAME
|
||||
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
||||
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
||||
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
||||
# The app instance name is probably what you are interested the most, since this is
|
||||
# guaranteed to be unique. This is a good unique identifier to define installation path,
|
||||
# db names, ...
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
is_public=$3
|
||||
title=$4
|
||||
privatelinkbydefault=$5
|
||||
admin=$6
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
title=$YNH_APP_ARG_TITLE
|
||||
privatelinkbydefault=$YNH_APP_ARG_PRIVATELINKBYDEFAULT
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
privateinstance=$YNH_APP_ARG_PRIVATEINSTANCE
|
||||
|
||||
# Load common variables and helpers
|
||||
source ./_common.sh
|
||||
|
||||
# Check that the options are compatible
|
||||
if [ $is_public = "Yes" ]; then
|
||||
if [ $privateinstance = "Yes" ] ; then
|
||||
ynh_die "Incompatible options: the instance cannot be both public and private" 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check that admin user is an existing account
|
||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "Error : the chosen admin user does not exist"
|
||||
exit 1
|
||||
ynh_die "Error : the chosen user does not exist" 1
|
||||
fi
|
||||
sudo yunohost app setting shaarli admin -v $admin
|
||||
sudo yunohost app setting $app admin -v $admin
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a shaarli
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -29,53 +52,70 @@ fi
|
|||
sudo apt-get install php5-cli -y -qq
|
||||
|
||||
# Copy files to the right place
|
||||
app_home_path=/home/yunohost.app/shaarli
|
||||
final_path=/var/www/shaarli
|
||||
app_home_path=/home/yunohost.app/$app
|
||||
final_path=/var/www/$app
|
||||
|
||||
sudo mkdir -p $final_path
|
||||
# Download and extract in /var/www
|
||||
extract_shaarli
|
||||
|
||||
sudo mkdir -p $app_home_path/data
|
||||
sudo mkdir -p $app_home_path/cache
|
||||
sudo mkdir -p $app_home_path/pagecache
|
||||
sudo mkdir -p $app_home_path/tmp
|
||||
sudo mkdir -p $app_home_path/conf
|
||||
sudo chown -R www-data: $app_home_path
|
||||
|
||||
# generate the salt
|
||||
salt=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
|
||||
# generate the hash with the password
|
||||
password_hash=$(php ../conf/gen_hash.php $password $admin $salt)
|
||||
|
||||
# set the proper value for substitution
|
||||
if [ $privatelinkbydefault = "No" ]; then
|
||||
privatelinkbydefault_php=false
|
||||
else
|
||||
privatelinkbydefault_php=true
|
||||
fi
|
||||
|
||||
sudo sed -i "s@YNH_SALT@$salt@g" ../conf/init_config.php
|
||||
sudo sed -i "s@YNH_TIMEZONE@$(cat /etc/timezone)@g" ../conf/init_config.php
|
||||
sudo sed -i "s@YNH_TITLE@$title@g" ../conf/init_config.php
|
||||
sudo sed -i "s@YNH_PRIVATE_LINK_BY_DEFAULT@$privatelinkbydefault_php@g" ../conf/init_config.php
|
||||
sudo sed -i "s@YNH_ADMIN@$admin@g" ../conf/init_config.php
|
||||
# Prepare the configuration file
|
||||
sudo sed -i "s@YNH_SALT@$salt@g" ../conf/config.json.php
|
||||
sudo sed -i "s@YNH_ADMIN@$admin@g" ../conf/config.json.php
|
||||
sudo sed -i "s@YNH_HASH@$password_hash@g" ../conf/config.json.php
|
||||
sudo sed -i "s@YNH_TIMEZONE@$(cat /etc/timezone)@g" ../conf/config.json.php
|
||||
sudo sed -i "s@YNH_TITLE@$title@g" ../conf/config.json.php
|
||||
sudo sed -i "s@YNH_PRIVATE_LINK_BY_DEFAULT@$privatelinkbydefault_php@g" ../conf/config.json.php
|
||||
# turn off authentication on the instance
|
||||
if [ $privateinstance = "Yes" ] ; then
|
||||
sudo sed -i "/open_shaarli/s/false/true/" ../conf/config.json.php
|
||||
fi
|
||||
|
||||
sudo cp ../conf/options.php $app_home_path/data/options.php
|
||||
sudo cp ../conf/init_config.php $app_home_path/data/config.php
|
||||
sudo php ../conf/init_config_user.php $(sudo yunohost user list --json | python ../conf/user_list.py)
|
||||
# Populate the data directory of the shaarli instance
|
||||
sudo cp ../conf/config.json.php $final_path/data
|
||||
sudo cp ../conf/datastore.php $final_path/data
|
||||
sudo cp ../conf/ipbans.php $final_path/data
|
||||
sudo cp ../conf/lastupdatecheck.txt $final_path/data
|
||||
sudo cp ../conf/log.txt $final_path/data
|
||||
sudo cp ../conf/updates.txt $final_path/data
|
||||
|
||||
# set proper permissions
|
||||
sudo find $final_path -type f | xargs sudo chmod 644
|
||||
sudo find $final_path -type d | xargs sudo chmod 755
|
||||
#sudo chown -R root: $final_path
|
||||
|
||||
sudo find $app_home_path -type f | xargs sudo chmod 600
|
||||
sudo find $app_home_path -type d | xargs sudo chmod 700
|
||||
sudo chown -R www-data: $app_home_path
|
||||
#set proper ownership of the files in /data
|
||||
sudo chown www-data:www-data $final_path/data/config.json.php
|
||||
sudo chown www-data:www-data $final_path/data/datastore.php
|
||||
sudo chown www-data:www-data $final_path/data/ipbans.php
|
||||
sudo chown www-data:www-data $final_path/data/lastupdatecheck.txt
|
||||
sudo chown www-data:www-data $final_path/data/log.txt
|
||||
sudo chown www-data:www-data $final_path/data/updates.txt
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sudo sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@YNH_ALIAS@$final_path@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shaarli.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
if [ $is_public = "Yes" ]; then
|
||||
sudo yunohost app setting shaarli unprotected_uris -v "/"
|
||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||
elif [ $privateinstance = "Yes" ] ; then
|
||||
# Configure SSOWat to prevent access for other users
|
||||
sudo yunohost app setting $app allowed_users -v "$admin"
|
||||
fi
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
domain=$(sudo yunohost app setting shaarli domain)
|
||||
# This is a multi-instance app, meaning it can be installed several times independently
|
||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
||||
# The app instance name is available as $YNH_APP_INSTANCE_NAME
|
||||
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
||||
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
||||
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
||||
# The app instance name is probably what you are interested the most, since this is
|
||||
# guaranteed to be unique. This is a good unique identifier to define installation path,
|
||||
# db names, ...
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
sudo rm -rf /var/www/shaarli
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/shaarli.conf
|
||||
sudo rm -rf /home/yunohost.app/shaarli/data
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
||||
sudo rm -rf /var/www/$app
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
sudo service nginx reload
|
||||
|
|
Loading…
Add table
Reference in a new issue