Add new script to update scanservjs and alter setup accordingly

This commit is contained in:
Alexandre CATTEAU 2022-03-21 12:36:26 +01:00
parent 7c95eb2920
commit 951adc1305
2 changed files with 23 additions and 9 deletions

6
scanservjs-update.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
echo "Installing scanservjs directly from GitHub..."
curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/packages/server/installer.sh | bash -s -- -a
exit 0

View File

@ -33,9 +33,11 @@ add_users() {
usermod -a -G lp saned
}
get_sync() { # TODO when new conf-sync will be available
get_sync() {
echo "Getting and deploying sync configuration"
sudo -H -u $user mkdir $sync_directory_path
sudo -H -u $user git clone https://gitea.kto.black/adminconf/printscan-server.git \
$sync_directory_path/printscan-server
sudo -H -u $user git clone https://gitea.kto.black/adminconf/rcs-general.git $sync_directory_path/rcs-general
sudo -H -u $user $sync_directoyy_path/rcs-general/install.sh
sudo -H -u $user git clone https://gitea.kto.black/adminconf/conf-sync.git $sync_directory_path/conf-sync
@ -62,19 +64,25 @@ ssh_pubkey() {
}
# based on https://github.com/sbs20/scanservjs/blob/master/docs/install.md
# install_scanservjs() {
# wget -O $run_directory_path/scanservjs.tar.gz $(curl -s \
# https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4)
# mkdir $run_directory_path/scanservjs
# tar -xf scanservjs.tar.gz -C $run_directory_path/scanservjs/
# $run_directory_path/scanservjs/installer.sh -i
# rm $run_directory_path/scanservjs.tar.gz
# rm -r $run_directory_path/scanservjs
# }
install_scanservjs() {
wget -O $run_directory_path/scanservjs.tar.gz $(curl -s \
https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4)
mkdir $run_directory_path/scanservjs
tar -xf scanservjs.tar.gz -C $run_directory_path/scanservjs/
sudo $run_directory_path/scanservjs/installer.sh -i
rm $run_directory_path/scanservjs.tar.gz
rm -r $run_directory_path/scanservjs
echo "Installing scanservjs directly from GitHub..."
curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/packages/server/installer.sh | bash -s -- -a
}
tls_cert() {
echo "Generating TLS certificate"
openssl req -newkey rsa:4096 -x509 -sha256 -days 999 -nodes -out $tls_directory/$cert -keyout $tls_directory/$cert_key -subj "/C=/ST=/L=/O=/OU=/CN="
openssl req -newkey rsa:4096 -x509 -sha256 -days 999 -nodes -out $tls_directory/$cert -keyout \
$tls_directory/$cert_key -subj "/C=/ST=/L=/O=/OU=/CN="
chmod o+r $tls_directory/$cert_key
}