mirror of
https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh.git
synced 2024-09-03 20:26:26 +02:00
manifest v2
This commit is contained in:
parent
117a8b2b0c
commit
f7e5a94611
9 changed files with 130 additions and 281 deletions
|
@ -1,7 +0,0 @@
|
||||||
SOURCE_URL=https://github.com/maniackcrudelis/ssh_chroot/archive/v1.3.tar.gz
|
|
||||||
SOURCE_SUM=d44b51f8d838fc9f929e6048b825c8f74d52f6a254764527bce1ed4a4c558652
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=tar.gz
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
||||||
SOURCE_EXTRACT=true
|
|
|
@ -1,82 +0,0 @@
|
||||||
{
|
|
||||||
"name": "ssh chroot directory",
|
|
||||||
"id": "ssh_chroot_dir",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "SSH chroot directories with quotas disk",
|
|
||||||
"fr": "Dossier SSH en chroot avec gestion de quotas"
|
|
||||||
},
|
|
||||||
"version": "1.3~ynh2",
|
|
||||||
"url": "https://github.com/maniackcrudelis/ssh_chroot",
|
|
||||||
"upstream": {
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"code": "https://github.com/maniackcrudelis/ssh_chroot"
|
|
||||||
},
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "",
|
|
||||||
"email": ""
|
|
||||||
},
|
|
||||||
"previous_maintainers": [{
|
|
||||||
"name": "Maniack Crudelis",
|
|
||||||
"email": "maniackc_dev@crudelis.fr"
|
|
||||||
}],
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 11.0.9"
|
|
||||||
},
|
|
||||||
"multi_instance": true,
|
|
||||||
"services": [
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install": [
|
|
||||||
{
|
|
||||||
"name": "ssh_user",
|
|
||||||
"type": "string",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose an new user for this directory",
|
|
||||||
"fr": "Choisissez un nouvel utilisateur pour ce dossier"
|
|
||||||
},
|
|
||||||
"help": {
|
|
||||||
"en": "It must be a new user, it will be created for this purpose.",
|
|
||||||
"fr": "Ce doit être un nouvel utilisateur, il sera créé pour cet usage."
|
|
||||||
},
|
|
||||||
"example": "johndoe"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"type": "password",
|
|
||||||
"help": {
|
|
||||||
"en": "OPTIONAL. It's better to use a public ssh key instead. See below.",
|
|
||||||
"fr": "OPTIONNEL. Il est préférable d'utiliser une clé publique. Voir ci-dessous."
|
|
||||||
},
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pub_key",
|
|
||||||
"type": "string",
|
|
||||||
"ask": {
|
|
||||||
"en": "Give the public ssh key",
|
|
||||||
"fr": "Donnez une clé publique ssh"
|
|
||||||
},
|
|
||||||
"help": {
|
|
||||||
"en": "OPTIONAL. You can use a password instead, but a ssh public key is more secure. Ask to your beneficiary for his public key.",
|
|
||||||
"fr": "OPTIONNEL. Vous pouvez utiliser un mot de passe à la place, mais une clé ssh publique est plus sécurisée. Demandez à votre bénéficiaire sa clé publique."
|
|
||||||
},
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "size",
|
|
||||||
"type": "string",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose the maximum space allowed to this user",
|
|
||||||
"fr": "Choississez l'espace maximum à allouer à cet utilisateur"
|
|
||||||
},
|
|
||||||
"help": {
|
|
||||||
"en": "Default Ko, Use M, G or T to specified another unit.",
|
|
||||||
"fr": "Ko par défaut, utilisez M, G ou T pour indiquer une autre unité."
|
|
||||||
},
|
|
||||||
"default": "10G"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
73
manifest.toml
Normal file
73
manifest.toml
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||||
|
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "ssh_chroot_dir"
|
||||||
|
name = "ssh chroot directory"
|
||||||
|
description.en = "SSH chroot directories with quotas disk"
|
||||||
|
description.fr = "Dossier SSH en chroot avec gestion de quotas"
|
||||||
|
|
||||||
|
version = "1.3~ynh2"
|
||||||
|
|
||||||
|
maintainers = []
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "GPL-3.0"
|
||||||
|
code = "https://github.com/maniackcrudelis/ssh_chroot"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.0.9"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = true
|
||||||
|
ldap = "not_relevant"
|
||||||
|
sso = "not_relevant"
|
||||||
|
disk = "5M"
|
||||||
|
ram.build = "0M"
|
||||||
|
ram.runtime = "0M"
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.ssh_user]
|
||||||
|
ask.en = "Choose a new user for this directory"
|
||||||
|
ask.fr = "Choisissez un nouvel utilisateur pour ce dossier"
|
||||||
|
help.en = "It must be a new user, it will be created for this purpose."
|
||||||
|
help.fr = "Ce doit être un nouvel utilisateur, il sera créé pour cet usage."
|
||||||
|
type = "string"
|
||||||
|
example = "johndoe"
|
||||||
|
|
||||||
|
[install.password]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
help.en = "OPTIONAL. It's better to use a public ssh key instead. See below."
|
||||||
|
help.fr = "OPTIONNEL. Il est préférable d'utiliser une clé publique. Voir ci-dessous."
|
||||||
|
type = "password"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[install.pub_key]
|
||||||
|
ask.en = "Give the public ssh key"
|
||||||
|
ask.fr = "Donnez une clé publique ssh"
|
||||||
|
help.en = "OPTIONAL. You can use a password instead, but a ssh public key is more secure. Ask to your beneficiary for his public key."
|
||||||
|
help.fr = "OPTIONNEL. Vous pouvez utiliser un mot de passe à la place, mais une clé ssh publique est plus sécurisée. Demandez à votre bénéficiaire sa clé publique."
|
||||||
|
type = "string"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[install.size]
|
||||||
|
ask.en = "Choose the maximum space allowed to this user"
|
||||||
|
ask.fr = "Choississez l'espace maximum à allouer à cet utilisateur"
|
||||||
|
help.en = "Default Ko, Use M, G or T to specified another unit."
|
||||||
|
help.fr = "Ko par défaut, utilisez M, G ou T pour indiquer une autre unité."
|
||||||
|
type = "string"
|
||||||
|
default = "10G"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.sources.main]
|
||||||
|
url = "https://github.com/maniackcrudelis/ssh_chroot/archive/v1.3.tar.gz"
|
||||||
|
sha256 = "d44b51f8d838fc9f929e6048b825c8f74d52f6a254764527bce1ed4a4c558652"
|
||||||
|
autoupdate.strategy = "latest_github_release"
|
||||||
|
autoupdate.asset = "*.tar.gz"
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
|
@ -44,7 +44,7 @@ ynh_send_readme_to_admin() {
|
||||||
type="${type:-install}"
|
type="${type:-install}"
|
||||||
|
|
||||||
# Get the value of admin_mail_html
|
# Get the value of admin_mail_html
|
||||||
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||||
admin_mail_html="${admin_mail_html:-0}"
|
admin_mail_html="${admin_mail_html:-0}"
|
||||||
|
|
||||||
# Retrieve the email of users
|
# Retrieve the email of users
|
||||||
|
@ -212,7 +212,7 @@ ynh_app_changelog () {
|
||||||
sed -i '/Merge branch .* into/d' changelog
|
sed -i '/Merge branch .* into/d' changelog
|
||||||
|
|
||||||
# Get the value of admin_mail_html
|
# Get the value of admin_mail_html
|
||||||
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||||
admin_mail_html="${admin_mail_html:-0}"
|
admin_mail_html="${admin_mail_html:-0}"
|
||||||
|
|
||||||
# If a html email is required. Apply html to the changelog.
|
# If a html email is required. Apply html to the changelog.
|
||||||
|
|
|
@ -10,26 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading installation settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -39,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
|
|
|
@ -9,27 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ssh_user=$YNH_APP_ARG_SSH_USER
|
|
||||||
password=${YNH_APP_ARG_PASSWORD:-}
|
|
||||||
pub_key=${YNH_APP_ARG_PUB_KEY:-}
|
|
||||||
size=$YNH_APP_ARG_SIZE
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -39,24 +18,15 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
||||||
# An unix user name can contains only :alnum: and . - _
|
# An unix user name can contains only :alnum: and . - _
|
||||||
# Replace all other characters by _
|
# Replace all other characters by _
|
||||||
ssh_user=${ssh_user//[^[:alnum:].\-_]/_}
|
ssh_user=${ssh_user//[^[:alnum:].\-_]/_}
|
||||||
|
ynh_app_setting_set --app="$app" --key=ssh_user --value="$ssh_user"
|
||||||
|
|
||||||
ynh_system_user_exists $ssh_user && ynh_die "This user already exist"
|
if ynh_system_user_exists "$ssh_user"; then
|
||||||
|
ynh_die "This user already exist!"
|
||||||
final_path=/opt/yunohost/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
if test -z "$password" && test -z "$pub_key"
|
|
||||||
then
|
|
||||||
ynh_die "You can't left empty both password and public key. Please fill at least one of them."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
if test -z "$password" && test -z "$pub_key"; then
|
||||||
# STORE SETTINGS FROM MANIFEST
|
ynh_die "You can't left empty both password and public key. Please fill at least one of them."
|
||||||
#=================================================
|
fi
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=ssh_user --value=$ssh_user
|
|
||||||
ynh_app_setting_set --app=$app --key=size --value=$size
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -65,9 +35,7 @@ ynh_app_setting_set --app=$app --key=size --value=$size
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -76,14 +44,13 @@ ynh_setup_source --dest_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Load functions quotas_xxx
|
# Load functions quotas_xxx
|
||||||
source "$final_path/unix_quotas/unix_quotas.sh"
|
source "$install_dir/unix_quotas/unix_quotas.sh"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DIRECTORY FOR THIS USER
|
# CREATE DIRECTORY FOR THIS USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
user_dir="/home/yunohost.app/ssh_chroot_directories/$ssh_user"
|
mkdir "$data_dir/$ssh_user"
|
||||||
mkdir -p "$user_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL QUOTAS SYSTEM
|
# INSTALL QUOTAS SYSTEM
|
||||||
|
@ -102,8 +69,7 @@ ynh_script_progression --message="Configure fstab to support quotas" --weight=3
|
||||||
|
|
||||||
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
|
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
|
||||||
# Set fstab
|
# Set fstab
|
||||||
if ! IS_PACKAGE_CHECK
|
if ! IS_PACKAGE_CHECK; then
|
||||||
then
|
|
||||||
quotas_find_mount_point "$user_dir"
|
quotas_find_mount_point "$user_dir"
|
||||||
quotas_set_fstab "$quotas_mount_point"
|
quotas_set_fstab "$quotas_mount_point"
|
||||||
|
|
||||||
|
@ -116,34 +82,26 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create the user with Chroot_manager" --weight=5
|
ynh_script_progression --message="Create the user with Chroot_manager" --weight=5
|
||||||
|
|
||||||
add_password=""
|
chroot_manager_args=()
|
||||||
if [ -n "$password" ]
|
|
||||||
then
|
if [ -n "$pub_key" ]; then
|
||||||
auth_opt="--password"
|
chroot_manager_args+=( --sshkey "$pub_key" )
|
||||||
auth_value="$password"
|
elif [ -n "$password" ]; then
|
||||||
|
chroot_manager_args+=( --password "$password" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
add_sshkey=""
|
if ! IS_PACKAGE_CHECK; then
|
||||||
if [ -n "$pub_key" ]
|
"$install_dir/chroot_manager.sh" adduser --name "$ssh_user" "${chroot_manager_args[@]}" --directory "$user_dir" --quota "$size"
|
||||||
then
|
|
||||||
ynh_app_setting_set $app pub_key $pub_key
|
|
||||||
auth_opt="--sshkey"
|
|
||||||
auth_value="$pub_key"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! IS_PACKAGE_CHECK
|
|
||||||
then
|
|
||||||
$final_path/chroot_manager.sh adduser --name $ssh_user $auth_opt "$auth_value" --directory "$user_dir" --quota $size
|
|
||||||
|
|
||||||
# Allow the user to use ssh
|
# Allow the user to use ssh
|
||||||
adduser $ssh_user ssh.app
|
adduser "$ssh_user" ssh.app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A LINK TO CHROOT_MANAGER
|
# ADD A LINK TO CHROOT_MANAGER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ln -sf $final_path/chroot_manager.sh /home/yunohost.app/ssh_chroot_directories/chroot_manager
|
ln -sf "$install_dir/chroot_manager.sh" /home/yunohost.app/ssh_chroot_directories/chroot_manager
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -152,7 +110,7 @@ ln -sf $final_path/chroot_manager.sh /home/yunohost.app/ssh_chroot_directories/c
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
chown -R root: "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DISCLAIMER
|
# DISCLAIMER
|
||||||
|
|
|
@ -9,16 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -26,7 +16,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Load functions quotas_xxx
|
# Load functions quotas_xxx
|
||||||
source "$final_path/unix_quotas/unix_quotas.sh"
|
source "$install_dir/unix_quotas/unix_quotas.sh"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE QUOTAS OPTIONS IN FSTAB
|
# REMOVE QUOTAS OPTIONS IN FSTAB
|
||||||
|
@ -36,8 +26,7 @@ ynh_script_progression --message="Remove quotas options in fstab" --weight=3
|
||||||
user_dir="/home/yunohost.app/ssh_chroot_directories/$ssh_user"
|
user_dir="/home/yunohost.app/ssh_chroot_directories/$ssh_user"
|
||||||
|
|
||||||
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
|
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
|
||||||
if ! IS_PACKAGE_CHECK
|
if ! IS_PACKAGE_CHECK; then
|
||||||
then
|
|
||||||
quotas_find_mount_point "$user_dir"
|
quotas_find_mount_point "$user_dir"
|
||||||
quotas_clean_fstab "$quotas_mount_point"
|
quotas_clean_fstab "$quotas_mount_point"
|
||||||
|
|
||||||
|
@ -51,17 +40,9 @@ fi
|
||||||
ynh_script_progression --message="Remove the user with Chroot_manager" --weight=3
|
ynh_script_progression --message="Remove the user with Chroot_manager" --weight=3
|
||||||
|
|
||||||
if ! IS_PACKAGE_CHECK; then
|
if ! IS_PACKAGE_CHECK; then
|
||||||
$final_path/chroot_manager.sh deluser --name $ssh_user
|
"$install_dir/chroot_manager.sh" deluser --name $ssh_user
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Remove app main directory" --weight=1
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,34 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -45,7 +17,7 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
|
@ -61,7 +33,7 @@ ynh_restore_file --origin_path="/home/yunohost.app/ssh_chroot_directories/$ssh_u
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Load functions ssh_chroot_xxx
|
# Load functions ssh_chroot_xxx
|
||||||
source "$final_path/ssh_chroot/ssh_chroot.sh"
|
source "$install_dir/ssh_chroot/ssh_chroot.sh"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL QUOTAS SYSTEM
|
# INSTALL QUOTAS SYSTEM
|
||||||
|
@ -80,8 +52,7 @@ ynh_script_progression --message="Configure fstab to support quotas" --weight=3
|
||||||
|
|
||||||
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
|
# https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh
|
||||||
# Set fstab
|
# Set fstab
|
||||||
if ! IS_PACKAGE_CHECK
|
if ! IS_PACKAGE_CHECK; then
|
||||||
then
|
|
||||||
quotas_find_mount_point "$user_dir"
|
quotas_find_mount_point "$user_dir"
|
||||||
quotas_set_fstab "$quotas_mount_point"
|
quotas_set_fstab "$quotas_mount_point"
|
||||||
|
|
||||||
|
@ -105,8 +76,7 @@ ssh_chroot_standard_binaries "$user_dir"
|
||||||
ssh_chroot_copy_binary rsync "$user_dir"
|
ssh_chroot_copy_binary rsync "$user_dir"
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
if ! IS_PACKAGE_CHECK
|
if ! IS_PACKAGE_CHECK; then
|
||||||
then
|
|
||||||
ssh_chroot_set_permissions "$user_dir" $ssh_user
|
ssh_chroot_set_permissions "$user_dir" $ssh_user
|
||||||
|
|
||||||
# Allow the user to use ssh
|
# Allow the user to use ssh
|
||||||
|
@ -117,14 +87,14 @@ fi
|
||||||
# UPDATE THE LINK TO CHROOT_MANAGER
|
# UPDATE THE LINK TO CHROOT_MANAGER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ln -sf $final_path/chroot_manager.sh /home/yunohost.app/ssh_chroot_directories/chroot_manager
|
ln -sf $install_dir/chroot_manager.sh /home/yunohost.app/ssh_chroot_directories/chroot_manager
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
chown -R root: $install_dir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -9,16 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -26,20 +16,6 @@ ynh_script_progression --message="Checking version..." --weight=1
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,7 +27,7 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -61,7 +37,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Load functions ssh_chroot_xxx
|
# Load functions ssh_chroot_xxx
|
||||||
source "$final_path/ssh_chroot/ssh_chroot.sh"
|
source "$install_dir/ssh_chroot/ssh_chroot.sh"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE THE CHROOT DIRECTORY
|
# UPDATE THE CHROOT DIRECTORY
|
||||||
|
@ -91,10 +67,10 @@ fi
|
||||||
# UPDATE THE LINK TO CHROOT_MANAGER
|
# UPDATE THE LINK TO CHROOT_MANAGER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ln -sf $final_path/chroot_manager.sh /home/yunohost.app/ssh_chroot_directories/chroot_manager
|
ln -sf $install_dir/chroot_manager.sh /home/yunohost.app/ssh_chroot_directories/chroot_manager
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
chown -R root: $install_dir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -103,7 +79,7 @@ chown -R root: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
chown -R root: $install_dir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
|
|
Loading…
Add table
Reference in a new issue