mirror of
https://github.com/YunoHost-Apps/archivebox_ynh.git
synced 2024-09-03 18:15:54 +02:00
more cleanup
This commit is contained in:
parent
4e0d631827
commit
d79d55aae9
2 changed files with 22 additions and 20 deletions
|
@ -143,8 +143,6 @@ pushd $final_path
|
||||||
ynh_npm ci
|
ynh_npm ci
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_node_path=$ynh_node
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -160,10 +158,10 @@ chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$datadir"
|
chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE ARCHIVEBOX CONFIG
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
# copy configuration file
|
|
||||||
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$datadir/ArchiveBox.conf"
|
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$datadir/ArchiveBox.conf"
|
||||||
|
|
||||||
# permissions
|
# permissions
|
||||||
|
@ -176,16 +174,17 @@ chown -R $app:www-data "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Initializing Archivebox" --weight=1
|
ynh_script_progression --message="Initializing Archivebox" --weight=1
|
||||||
|
|
||||||
cd $datadir && ynh_exec_as $app $archivebox_cmd init
|
pushd $datadir
|
||||||
|
ynh_exec_as $app $archivebox_cmd init
|
||||||
|
|
||||||
ynh_script_progression --message="Checking if admin superuser already exists: $admin" --weight=1
|
ynh_script_progression --message="Checking if admin superuser already exists: $admin" --weight=1
|
||||||
USER_EXISTS=$(cd $datadir && ynh_exec_as $app $archivebox_cmd manage shell -c "from django.contrib.auth.models import User; print(User.objects.filter(username='$admin').count())")
|
USER_EXISTS=$(ynh_exec_as $app $archivebox_cmd manage shell -c "from django.contrib.auth.models import User; print(User.objects.filter(username='$admin').count())")
|
||||||
ynh_script_progression --message="Found users: $USER_EXISTS" --weight=1
|
ynh_script_progression --message="Found users: $USER_EXISTS" --weight=1
|
||||||
|
|
||||||
if [ $USER_EXISTS -eq 1 ]
|
if [ $USER_EXISTS -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="User already exists: setting admin password" --weight=1
|
ynh_script_progression --message="User already exists: setting admin password" --weight=1
|
||||||
ynh_exec_as $app /usr/bin/expect<<EOF
|
ynh_exec_as $app /usr/bin/expect<<EOF
|
||||||
set force_conservative 0 ;
|
set force_conservative 0 ;
|
||||||
set timeout -1
|
set timeout -1
|
||||||
spawn sh -c "cd $datadir && $archivebox_cmd manage changepassword $admin"
|
spawn sh -c "cd $datadir && $archivebox_cmd manage changepassword $admin"
|
||||||
|
@ -196,9 +195,9 @@ expect "*?assword (again): "
|
||||||
send -- "$password\r"
|
send -- "$password\r"
|
||||||
expect eof
|
expect eof
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
ynh_script_progression --message="Creating new archivebox superuser: $admin" --weight=1
|
ynh_script_progression --message="Creating new archivebox superuser: $admin" --weight=1
|
||||||
ynh_exec_as $app /usr/bin/expect<<EOF
|
ynh_exec_as $app /usr/bin/expect<<EOF
|
||||||
set force_conservative 0 ;
|
set force_conservative 0 ;
|
||||||
set timeout -1
|
set timeout -1
|
||||||
spawn sh -c "cd $datadir && $archivebox_cmd manage createsuperuser --username $admin --email $admin_mail"
|
spawn sh -c "cd $datadir && $archivebox_cmd manage createsuperuser --username $admin --email $admin_mail"
|
||||||
|
@ -209,10 +208,11 @@ expect "*?assword (again): "
|
||||||
send -- "$password\r"
|
send -- "$password\r"
|
||||||
expect eof
|
expect eof
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
||||||
cd $datadir && ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
|
ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
|
@ -99,10 +99,10 @@ ynh_add_nginx_config
|
||||||
# UPGRADE VIA PIP
|
# UPGRADE VIA PIP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_use_nodejs
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading via pip" --weight=1
|
ynh_script_progression --message="Upgrading via pip" --weight=1
|
||||||
|
ynh_use_nodejs
|
||||||
python3 -m venv "${final_path}/venv"
|
python3 -m venv "${final_path}/venv"
|
||||||
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
||||||
chown -R "$app" "$final_path"
|
chown -R "$app" "$final_path"
|
||||||
|
@ -121,7 +121,9 @@ then
|
||||||
|
|
||||||
# rerun archivebox setup (its idempotent, so it should be ok during upgrade)
|
# rerun archivebox setup (its idempotent, so it should be ok during upgrade)
|
||||||
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
||||||
cd $datadir && ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
|
pushd $datadir
|
||||||
|
ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
|
||||||
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
|
Loading…
Add table
Reference in a new issue