mirror of
https://github.com/YunoHost-Apps/archivebox_ynh.git
synced 2024-09-03 18:15:54 +02:00
Change install and upgrade to use archivebox command from virtualenv
This commit is contained in:
parent
bcf32b2bb9
commit
91c0c420cd
2 changed files with 12 additions and 6 deletions
|
@ -157,6 +157,9 @@ chown -R "$app" "$final_path"
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
|
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# we use this virtualenv archivebox for further commands now
|
||||||
|
archivebox_cmd="$final_path/venv/bin/archivebox"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -177,10 +180,10 @@ chown -R $app:www-data "$datadir"
|
||||||
# INITIALIZE ARCHIVEBOX
|
# INITIALIZE ARCHIVEBOX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Initializing Archivebox" --weight=1
|
ynh_script_progression --message="Initializing Archivebox" --weight=1
|
||||||
cd $datadir && ynh_exec_as $app archivebox init
|
cd $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 manage shell -c "from django.contrib.auth.models import User; print(User.objects.filter(username='$admin').count())")
|
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())")
|
||||||
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 ]
|
||||||
|
@ -189,7 +192,7 @@ then
|
||||||
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 manage changepassword $admin"
|
spawn sh -c "cd $datadir && $archivebox_cmd manage changepassword $admin"
|
||||||
match_max 100000
|
match_max 100000
|
||||||
expect "*?assword: "
|
expect "*?assword: "
|
||||||
send -- "$password\r"
|
send -- "$password\r"
|
||||||
|
@ -202,7 +205,7 @@ else
|
||||||
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 manage createsuperuser --username $admin --email $admin_mail"
|
spawn sh -c "cd $datadir && $archivebox_cmd manage createsuperuser --username $admin --email $admin_mail"
|
||||||
match_max 100000
|
match_max 100000
|
||||||
expect "*?assword: "
|
expect "*?assword: "
|
||||||
send -- "$password\r"
|
send -- "$password\r"
|
||||||
|
@ -213,7 +216,7 @@ 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 archivebox init --setup
|
cd $datadir && ynh_exec_as $app $archivebox_cmd init --setup
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
|
|
@ -103,9 +103,12 @@ then
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
|
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# we use this virtualenv archivebox for further commands now
|
||||||
|
archivebox_cmd="$final_path/venv/bin/archivebox"
|
||||||
|
|
||||||
# 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 archivebox init --setup
|
cd $datadir && ynh_exec_as $app $archivebox_cmd init --setup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
# FIXME: this should be managed by the core in the future
|
||||||
|
|
Loading…
Add table
Reference in a new issue