diff --git a/clean-cloud.service b/clean-cloud.service deleted file mode 100644 index 908adce..0000000 --- a/clean-cloud.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Clean remote dropbox - -[Service] -User=scan -Type=oneshot -ExecStart=/home/scan/.sync/clean-cloud.sh diff --git a/clean-cloud.sh b/clean-cloud.sh deleted file mode 100644 index a01dd7c..0000000 --- a/clean-cloud.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# The purpose of this script is to automatically empty our remote sandbox. -# This script is not to be run as root, rather as the user responsible for scanning. - -# Only run if the user is not root -if [[ $USER = 'root' ]] ; then - echo "You must not run this script as root!" - exit 1 -fi - -# Set parameters -remote_path='https://cloud.kto.black/remote.php/webdav/Scans' -remote_user='scan' -remote_passwd='rB2TgFpNXk3BbZ44' -subdirectories_prefix='scans' - -yesterday=$(date -d "-1 days" +"%Y%m%d") -today=$(date +"%Y%m%d") - -curl -s -u $remote_user:$remote_passwd -X DELETE $remote_path/$subdirectories_prefix-$yesterday -curl -s -u $remote_user:$remote_passwd -X MKCOL $remote_path/$subdirectories_prefix-$today - -echo "Cleaning done." -exit 0 diff --git a/clean-cloud.timer b/clean-cloud.timer deleted file mode 100644 index 8a8e428..0000000 --- a/clean-cloud.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Run clean-cloud regularly - -[Timer] -OnCalendar=*-*-* 02:00:00 -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/novnc.service b/novnc.service deleted file mode 100644 index cff13cd..0000000 --- a/novnc.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=noVNC proxy with Websockify - -[Service] -User=scan -Type=simple -ExecStart=/usr/bin/websockify --ssl-only --cert /etc/ssl/cert.crt --key /etc/ssl/cert.key --web /usr/share/novnc 8080 localhost:5900 - -[Install] -WantedBy=default.target diff --git a/scan-to-cloud.path b/scan-to-cloud.path deleted file mode 100644 index 0a182b4..0000000 --- a/scan-to-cloud.path +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Run scan-to-cloud when a new document is scanned - -[Path] -DirectoryNotEmpty=/scan - -[Install] -WantedBy=paths.target diff --git a/scan-to-cloud.service b/scan-to-cloud.service deleted file mode 100644 index a9b7500..0000000 --- a/scan-to-cloud.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Upload scanned document to dropbox - -[Service] -User=scan -Type=oneshot -ExecStart=/home/scan/.sync/scan-to-cloud.sh diff --git a/scan-to-cloud.sh b/scan-to-cloud.sh deleted file mode 100644 index 69fd292..0000000 --- a/scan-to-cloud.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# The purpose of this script is to automaticaly upload scanned documents to a remote dropbox. -# This script is not to be run as root, rather as the user responsible for scanning. - -# Only run if the user is not root -if [[ $USER = 'root' ]] ; then - echo "You must not run this script as root!" - exit 1 -fi - -# Set parameters -scan_directory='/scan' -remote_path='https://cloud.kto.black/remote.php/webdav/Scans' -remote_user='scan' -remote_passwd='rB2TgFpNXk3BbZ44' -subdirectories_prefix='scans' - -today=$(date +"%Y%m%d") - -# The script is executed a bit too early, so we need to wait a few seconds. -sleep 5s - -for filename in $scan_directory/*; do - #echo "Creating today's directory..." # I'd like to remove these 2 lines - #curl -s -u $remote_user:$remote_passwd -X MKCOL $remote_path/$subdirectories_prefix-$today - echo "Uploading $filename..." - curl -s -u $remote_user:$remote_passwd -T "$filename" $remote_path/$subdirectories_prefix-$today/ - rm "$filename" -done - -echo "Upload done." -exit 0 diff --git a/scan.mount b/scan.mount deleted file mode 100644 index dd32fd2..0000000 --- a/scan.mount +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=tmpfs for scanned documents - -[Mount] -What=tmpfs -Where=/scan -Type=tmpfs -Options=noatime,uid=1001,gid=1001 - -[Install] -WantedBy=default.target diff --git a/setup.sh b/setup.sh index 923a27f..c5fef4d 100644 --- a/setup.sh +++ b/setup.sh @@ -56,6 +56,11 @@ set_cups_conf() { ln -s $sync_directory_path/cupsd.conf $cups_conf_path/cupsd.conf } +set_sane_conf() { + echo $printscan_container_ip >> /etc/sane.d/saned.conf + systemctl enable saned.socket +} + rcs_links() { echo "Linking rcs" rm /home/$user/.bashrc @@ -97,6 +102,7 @@ scan_user_home_directory="/home/$scan_user" sync_directory_path="/home/$user/.sync" systemd_units_path='/etc/systemd/system' cups_conf_path='/etc/cups' +printscan_container_ip='192.168.0.91' remote_pubkey_location='https://keys.kto.black' remote_pubkey='home.pub' @@ -108,6 +114,7 @@ add_users get_conf set_conf set_cups_conf +set_sane_conf rcs_links ssh_pubkey diff --git a/vnc.socket b/vnc.socket deleted file mode 100644 index a4b577e..0000000 --- a/vnc.socket +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=VNC incoming socket - -[Socket] -ListenStream=127.0.0.1:5900 -Accept=yes -MaxConnections=5 - -[Install] -WantedBy=sockets.target diff --git a/vnc@.service b/vnc@.service deleted file mode 100644 index 35ff490..0000000 --- a/vnc@.service +++ /dev/null @@ -1,14 +0,0 @@ -# VNC password should be set in /etc/passwdd -# TODO we still need to handle session termination - -[Unit] -Description=Specific x11vnc session -OnFailure=scan-to-cloud.service - -[Service] -User=scan -Type=simple -ExecStart=/usr/bin/x11vnc -once -create -localhost -inetd -bg -o /var/log/x11vnc.log -rfbauth /etc/passwdd -#ExecStop=/usr/bin/x11vnc -R stop # TODO test that, unless it prevents OnFailure from working -StandardInput=socket -StandardError=syslog