1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/archivebox_ynh.git synced 2024-09-03 18:15:54 +02:00
This commit is contained in:
yalh76 2022-09-22 00:37:16 +02:00
parent 89938959e6
commit 10848b078a
2 changed files with 55 additions and 12 deletions

View file

@ -111,7 +111,7 @@ ynh_add_nginx_config
#=================================================
# PIP INSTALLATION
#=================================================
ynh_script_progression --message="Install project via pip..." --weight=80
ynh_script_progression --message="Installing project via pip..." --weight=80
python3 -m venv "${final_path}/venv"
cp ../conf/requirements.txt "$final_path/requirements.txt"
@ -134,13 +134,13 @@ archivebox_cmd="$final_path/venv/bin/archivebox"
#=================================================
# INSTALL NODE DEPENDENCIES
#=================================================
ynh_script_progression --message="Install node dependencies..."
ynh_script_progression --message="Installing node dependencies..."
ynh_use_nodejs
cp ../conf/package.json "$final_path/package.json"
cp ../conf/package-lock.json "$final_path/package-lock.json"
pushd $final_path
ynh_npm ci
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
popd
#=================================================
@ -164,10 +164,8 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$datadir/ArchiveBox.conf"
# permissions
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
chmod 400 "$datadir/ArchiveBox.conf"
chown $app:$app "$datadir/ArchiveBox.conf"
#=================================================
# INITIALIZE ARCHIVEBOX

View file

@ -77,6 +77,22 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
mkdir -p $final_path
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -118,7 +134,40 @@ then
# we use this virtualenv archivebox for further commands now
archivebox_cmd="$final_path/venv/bin/archivebox"
fi
#=================================================
# UPGRADE NODE DEPENDENCIES
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading node dependencies..."
cp -f ../conf/package.json "$final_path/package.json"
cp -f ../conf/package-lock.json "$final_path/package-lock.json"
pushd $final_path
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
popd
fi
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$datadir/ArchiveBox.conf"
chmod 400 "$datadir/ArchiveBox.conf"
chown $app:$app "$datadir/ArchiveBox.conf"
#=================================================
# FINISH ARCHIVEBOX SETUP
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# rerun archivebox setup (its idempotent, so it should be ok during upgrade)
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
pushd $datadir
@ -126,10 +175,6 @@ then
popd
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SETUP SYSTEMD
#=================================================