mirror of
https://github.com/YunoHost-Apps/zerobin_ynh.git
synced 2024-09-03 18:06:01 +02:00
Upgrade to PrivateBin (maintained fork)
This commit is contained in:
parent
07542b8950
commit
be2aae7d4e
3 changed files with 33 additions and 4 deletions
17
scripts/_common
Normal file
17
scripts/_common
Normal file
|
@ -0,0 +1,17 @@
|
|||
PRIVATEBIN_VERSION="0.22"
|
||||
PRIVATEBIN_SOURCE_URL="https://github.com/PrivateBin/PrivateBin/archive/${PRIVATEBIN_VERSION}.tar.gz"
|
||||
PRIVATEBIN_SOURCE_SHA256="cde40cf24af63e6908abbfff021c739258e99d1405d104992fc70f33adbadc25"
|
||||
|
||||
extract_source() {
|
||||
local DESTDIR=$1
|
||||
|
||||
# retrieve and extract Roundcube tarball
|
||||
rc_tarball="${DESTDIR}/privatebin.tar.gz"
|
||||
sudo wget -q -O "$rc_tarball" "$PRIVATEBIN_SOURCE_URL" \
|
||||
|| ynh_die "Unable to download source tarball"
|
||||
echo "$PRIVATEBIN_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \
|
||||
|| ynh_die "Invalid checksum of downloaded tarball"
|
||||
sudo tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \
|
||||
|| ynh_die "Unable to extract source tarball"
|
||||
sudo rm "$rc_tarball"
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
source ./_common
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
|
@ -19,7 +22,7 @@ fi
|
|||
# Copy files to the right place
|
||||
final_path=/var/www/zerobin
|
||||
sudo mkdir -p $final_path
|
||||
sudo cp -a ../sources/* $final_path
|
||||
extract_source $final_path
|
||||
|
||||
# Files owned by root, www-data can just read
|
||||
sudo find $final_path -type f | xargs sudo chmod 644
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
source ./_common
|
||||
|
||||
domain=$(sudo yunohost app setting zerobin domain)
|
||||
path=$(sudo yunohost app setting zerobin path)
|
||||
is_public=$(sudo yunohost app setting zerobin is_public)
|
||||
|
@ -9,10 +12,16 @@ if [[ ! "$path" == "/" ]]; then
|
|||
path=${path%/}
|
||||
fi
|
||||
|
||||
# Copy files to the right place
|
||||
# Init final_path, if ever it got deleted somehow
|
||||
final_path=/var/www/zerobin
|
||||
sudo mkdir -p $final_path
|
||||
sudo cp -a ../sources/* $final_path
|
||||
|
||||
# Clean up
|
||||
# This will remove old paste data (otherwise we would need to lower down security)
|
||||
sudo rm -rf $final_path/*
|
||||
|
||||
# Copy files to the right place
|
||||
extract_source $final_path
|
||||
|
||||
# Files owned by root, www-data can just read
|
||||
sudo find $final_path -type f | xargs sudo chmod 644
|
||||
|
@ -20,7 +29,7 @@ sudo find $final_path -type d | xargs sudo chmod 755
|
|||
sudo chown -R root: $final_path
|
||||
|
||||
# except for data and tmp subdir, where www-data must have write permissions
|
||||
sudo chown www-data:root $final_path/{data,tmp}
|
||||
sudo chown -R www-data:root $final_path/{data,tmp}
|
||||
sudo chmod 700 $final_path/{data,tmp}
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
|
|
Loading…
Add table
Reference in a new issue