mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Use helper ynh_setup_source
This commit is contained in:
parent
7c2f3cbd60
commit
103af5dba1
9 changed files with 45 additions and 58 deletions
11
conf/arm.src
Normal file
11
conf/arm.src
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v6.2.3/seafile-server_6.2.3_stable_pi.tar.gz
|
||||||
|
SOURCE_SUM=e23af4882e8b20c8ded8c052e9863a52dbb685f16deff0322e21d6e9ded35b56
|
||||||
|
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||||
|
# default: sha256
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
# (Optional) Archive format
|
||||||
|
# default: tar.gz
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
# (Optional) Put false if sources are directly in the archive root
|
||||||
|
# default: true
|
||||||
|
SOURCE_IN_SUBDIR=true
|
11
conf/i386.src
Normal file
11
conf/i386.src
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SOURCE_URL=https://download.seadrive.org/seafile-server_6.2.3_i386.tar.gz
|
||||||
|
SOURCE_SUM=4439e13211a4c0dd7831d728fc50371d9be0e31dfa344b1c951de90b42afe0bf
|
||||||
|
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||||
|
# default: sha256
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
# (Optional) Archive format
|
||||||
|
# default: tar.gz
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
# (Optional) Put false if sources are directly in the archive root
|
||||||
|
# default: true
|
||||||
|
SOURCE_IN_SUBDIR=true
|
11
conf/x86-64.src
Normal file
11
conf/x86-64.src
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SOURCE_URL=https://download.seadrive.org/seafile-server_6.2.3_x86-64.tar.gz
|
||||||
|
SOURCE_SUM=166a022786c8bb85d5890741f9632f10df3ba299736c59576ab1f6e4f6597ac8
|
||||||
|
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||||
|
# default: sha256
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
# (Optional) Archive format
|
||||||
|
# default: tar.gz
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
# (Optional) Put false if sources are directly in the archive root
|
||||||
|
# default: true
|
||||||
|
SOURCE_IN_SUBDIR=true
|
|
@ -3,11 +3,6 @@
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
## Adapt sha256sum while you update app
|
|
||||||
x86_64sum="166a022786c8bb85d5890741f9632f10df3ba299736c59576ab1f6e4f6597ac8"
|
|
||||||
i386sum="4439e13211a4c0dd7831d728fc50371d9be0e31dfa344b1c951de90b42afe0bf"
|
|
||||||
armsum="e23af4882e8b20c8ded8c052e9863a52dbb685f16deff0322e21d6e9ded35b56"
|
|
||||||
|
|
||||||
# Detect the system architecture to download the right tarball
|
# Detect the system architecture to download the right tarball
|
||||||
# NOTE: `uname -m` is more accurate and universal than `arch`
|
# NOTE: `uname -m` is more accurate and universal than `arch`
|
||||||
# See https://en.wikipedia.org/wiki/Uname
|
# See https://en.wikipedia.org/wiki/Uname
|
||||||
|
@ -64,7 +59,6 @@ set_path_2() {
|
||||||
|
|
||||||
config_nginx() {
|
config_nginx() {
|
||||||
|
|
||||||
|
|
||||||
# In the 3.x seafile version package the seahub_port and fileserver_port wasn't saved in the settings. If the settings is empty we try to get it and save in the settings
|
# In the 3.x seafile version package the seahub_port and fileserver_port wasn't saved in the settings. If the settings is empty we try to get it and save in the settings
|
||||||
|
|
||||||
if [[ -z $seahub_port ]] || [[ -z $fileserver_port ]]
|
if [[ -z $seahub_port ]] || [[ -z $fileserver_port ]]
|
||||||
|
@ -87,35 +81,9 @@ config_nginx() {
|
||||||
systemctl reload nginx.service
|
systemctl reload nginx.service
|
||||||
}
|
}
|
||||||
|
|
||||||
get_source() {
|
install_source() {
|
||||||
if [[ $1 == 'arm' ]]
|
mkdir "$final_path/seafile-server-$seafile_version"
|
||||||
then
|
ynh_setup_source "$final_path/seafile-server-$seafile_version" "$architecture"
|
||||||
wget -q -O '/tmp/seafile_src.tar.gz' 'https://github.com/haiwen/seafile-rpi/releases/download/v'$2'/seafile-server_'$2'_stable_pi.tar.gz'
|
|
||||||
sha256sum=$armsum
|
|
||||||
elif [[ $1 == 'x86-64' ]]
|
|
||||||
then
|
|
||||||
wget -q -O '/tmp/seafile_src.tar.gz' 'https://download.seadrive.org/seafile-server_'$2'_x86-64.tar.gz'
|
|
||||||
sha256sum=$x86_64sum
|
|
||||||
else
|
|
||||||
wget -q -O '/tmp/seafile_src.tar.gz' 'https://download.seadrive.org/seafile-server_'$2'_i386.tar.gz'
|
|
||||||
sha256sum=$i386sum
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -e '/tmp/seafile_src.tar.gz' ]] || [[ $(sha256sum '/tmp/seafile_src.tar.gz' | cut -d' ' -f1) != $sha256sum ]]
|
|
||||||
then
|
|
||||||
ynh_die "Error : can't get seafile source"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
extract_source() {
|
|
||||||
mkdir -p $final_path/seafile-server-$seafile_version
|
|
||||||
tar xzf '/tmp/seafile_src.tar.gz'
|
|
||||||
mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version
|
|
||||||
mv '/tmp/seafile_src.tar.gz' $final_path/installed/seafile-server_${seafile_version}.tar.gz
|
|
||||||
|
|
||||||
local old_dir=$(pwd)
|
|
||||||
(cd "$final_path/seafile-server-$seafile_version" && patch -p1 < $YNH_CWD/../sources/sso_auth.patch) || ynh_die "Unable to apply patches"
|
|
||||||
cd $old_dir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dependance() {
|
install_dependance() {
|
||||||
|
@ -129,14 +97,3 @@ ynh_clean_setup () {
|
||||||
pkill -f ccnet-server
|
pkill -f ccnet-server
|
||||||
pkill -f "seahub"
|
pkill -f "seahub"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get application version from manifest
|
|
||||||
#
|
|
||||||
# usage: ynh_app_version
|
|
||||||
ynh_app_version() {
|
|
||||||
manifest_path="../manifest.json"
|
|
||||||
if [ ! -e "$manifest_path" ]; then
|
|
||||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
|
||||||
fi
|
|
||||||
echo $(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file.
|
|
||||||
}
|
|
|
@ -46,9 +46,6 @@ ynh_app_setting_set $app webdav_port $webdav_port
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
ynh_app_setting_set $app installed_version $seafile_version
|
ynh_app_setting_set $app installed_version $seafile_version
|
||||||
|
|
||||||
# Download new version from sources
|
|
||||||
get_source $architecture $seafile_version
|
|
||||||
|
|
||||||
# Retrieve admin email
|
# Retrieve admin email
|
||||||
admin_email=$(yunohost user info $admin | grep mail: | sed "s/mail: //g")
|
admin_email=$(yunohost user info $admin | grep mail: | sed "s/mail: //g")
|
||||||
|
|
||||||
|
@ -56,13 +53,14 @@ admin_email=$(yunohost user info $admin | grep mail: | sed "s/mail: //g")
|
||||||
install_dependance
|
install_dependance
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
test -e $final_path && rm -rf "$final_path"
|
test -e $seafile_data && ynh_secure_remove "$seafile_data"
|
||||||
test -e $seafile_data && rm -rf "$seafile_data"
|
|
||||||
mkdir -p $final_path
|
mkdir -p $final_path
|
||||||
mkdir -p $final_path/installed
|
mkdir -p $final_path/installed
|
||||||
mkdir -p $final_path/logs
|
mkdir -p $final_path/logs
|
||||||
mkdir -p $final_path/seafile-data
|
mkdir -p $final_path/seafile-data
|
||||||
extract_source
|
|
||||||
|
# Download new version from sources
|
||||||
|
install_source
|
||||||
|
|
||||||
# init databases
|
# init databases
|
||||||
dbuser=seafile
|
dbuser=seafile
|
||||||
|
|
|
@ -27,15 +27,12 @@ get_configuration
|
||||||
# Create special path with / at the end
|
# Create special path with / at the end
|
||||||
set_path_2
|
set_path_2
|
||||||
|
|
||||||
# Download new version from sources
|
|
||||||
get_source $architecture $seafile_version
|
|
||||||
|
|
||||||
# stop seafile server
|
# stop seafile server
|
||||||
systemctl stop seafile-server.service
|
systemctl stop seafile-server.service
|
||||||
|
|
||||||
# extract new version
|
# extract new version
|
||||||
test -e $final_path/seafile-server-$seafile_version && rm -rf "$final_path/seafile-server-$seafile_version"
|
test -e $final_path/seafile-server-$seafile_version && ynh_secure_remove "$final_path/seafile-server-$seafile_version"
|
||||||
extract_source
|
install_source
|
||||||
|
|
||||||
# permission to execute update script and expect helper
|
# permission to execute update script and expect helper
|
||||||
chmod +x ../conf/upgrade_*.exp
|
chmod +x ../conf/upgrade_*.exp
|
||||||
|
@ -148,7 +145,7 @@ systemctl daemon-reload
|
||||||
chown -R $seafile_user:$seafile_user $final_path
|
chown -R $seafile_user:$seafile_user $final_path
|
||||||
|
|
||||||
# delete seafile cache
|
# delete seafile cache
|
||||||
rm -rf /tmp/seahub_cache
|
ynh_secure_remove /tmp/seahub_cache
|
||||||
|
|
||||||
# restart seafile server
|
# restart seafile server
|
||||||
systemctl start seafile-server.service
|
systemctl start seafile-server.service
|
||||||
|
|
1
sources/patches/arm-sso_auth.patch
Symbolic link
1
sources/patches/arm-sso_auth.patch
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
x86-64-sso_auth.patch
|
1
sources/patches/i386-sso_auth.patch
Symbolic link
1
sources/patches/i386-sso_auth.patch
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
x86-64-sso_auth.patch
|
Loading…
Reference in a new issue