1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nitter_ynh.git synced 2024-09-03 19:46:24 +02:00

Minor improvements to scripts

This commit is contained in:
Jules Bertholet 2021-04-17 21:40:36 -04:00
parent a546fb8736
commit 8b7594a118
4 changed files with 29 additions and 33 deletions

View file

@ -11,6 +11,28 @@ pkg_dependencies="acl nim redis-server libsass-dev"
# PERSONAL HELPERS
#=================================================
function build_nitter {
pushd "$final_path" || ynh_die
chown -R $app:$app $final_path
sudo -u $app env "PATH=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble build -d:release -y
sudo -u $app env "PATH=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble scss -y
mkdir -p $final_path/tmp
chown -R root:root $final_path
popd || ynh_die
}
function set_permissions {
chown -R root:$app $final_path
chown -R $app:$app $final_path/tmp
chmod -R g=u,g-w,o-rwx $final_path
setfacl -n -m u:www-data:--x $final_path
setfacl -nR -m u:www-data:r-x -m d:u:www-data:r-x $final_path/public
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Check the architecture
#
# example: architecture=$(ynh_detect_arch)
@ -35,10 +57,6 @@ ynh_detect_arch(){
echo $architecture
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -132,13 +132,8 @@ usermod -d $final_path $app 2>&1
# COMPILE NITTER
#=================================================
ynh_script_progression --message="Compiling Nitter..." --weight=30
pushd "$final_path" || ynh_die
chown -R $app:$app $final_path
sudo -u $app "PATH=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" $final_path/nim-installation/bin/nimble build -d:release -y
sudo -u $app "PATH=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" $final_path/nim-installation/bin/nimble scss -y
mkdir -p $final_path/tmp
chown -R root:root $final_path
popd || ynh_die
build_nitter
#=================================================
# SETUP SYSTEMD
@ -159,11 +154,7 @@ ynh_add_config --template="nitter.conf" --destination="$final_path/nitter.conf"
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root:$app $final_path
chown -R $app:$app $final_path/tmp
chmod -R g=u,g-w,o-rwx $final_path
setfacl -n -m user:www-data:rx $final_path
setfacl -n -R -m user:www-data:rx -m default:user:www-data:rx $final_path/public
set_permissions
#=================================================
# INTEGRATE SERVICE IN YUNOHOST

View file

@ -78,11 +78,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# Restore permissions on app files
chown -R root:$app $final_path
chown -R $app:$app $final_path/tmp
chmod -R g=u,g-w,o-rwx $final_path
setfacl -n -m user:www-data:rx $final_path
setfacl -n -R -m user:www-data:rx -m default:user:www-data:rx $final_path/public
set_permissions
#=================================================
# SPECIFIC RESTORATION

View file

@ -106,13 +106,8 @@ usermod -d $final_path $app 2>&1
# COMPILE NITTER
#=================================================
ynh_script_progression --message="Compiling Nitter..." --weight=30
pushd "$final_path" || ynh_die
chown -R $app:$app $final_path
sudo -u $app "PATH=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" $final_path/nim-installation/bin/nimble build -d:release -y
sudo -u $app "PATH=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" $final_path/nim-installation/bin/nimble scss -y
mkdir -p $final_path/tmp
chown -R root:root $final_path
popd || ynh_die
build_nitter
#=================================================
# SETUP SYSTEMD
@ -134,11 +129,7 @@ ynh_add_config --template="nitter.conf" --destination="$final_path/nitter.conf"
#=================================================
# Set permissions on app files
chown -R root:$app $final_path
chown -R $app:$app $final_path/tmp
chmod -R g=u,g-w,o-rwx $final_path
setfacl -n -m user:www-data:rx $final_path
setfacl -n -R -m user:www-data:rx -m default:user:www-data:rx $final_path/public
set_permissions
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================