#!/usr/bin/sudo /bin/bash
startDir=$(pwd);
if [ -d '/usr/share/sane/' ]; then
if [ ! -d '/usr/share/sane/gt68xx' ]; then
mkdir '/usr/share/sane/gt68xx';
chmod 755 '/usr/share/sane/gt68xx';
fi
cd '/usr/share/sane/gt68xx';
echo 'Driver firmware download directory is:';
pwd;
echo 'Starting downlad...';
wget 'http://www.meier-geinitz.de/sane/gt68xx-backend/firmware/sbfw.usb';
chmod 644 'sbfw.usb';
cd '/etc/sane.d/';
echo "Seting up /etc/sane.d/gt68xx.conf file";
myDate=$(date '+%F_%H:%M:%S');
sed -i.backup_${myDate} -e 's/^#override "mustek-scanexpress-1200-ub-plus"/override "mustek-scanexpress-1200-ub-plus"/' 'gt68xx.conf';
echo "Device should be ready for use!"
echo '';
sleep 3;
cd $startDir;
else
echo 'Sane is not installed. I try to install and restart:';
echo '';
apt update; apt install sane;
$0;
fi