54 lines
1.4 KiB
Bash

#!/bin/bash
driversPath='/drivers'
ls -lah $driversPath
fetch_sdk() {
echo "Trying to fetch from remote"
let pwd=$PWD
cd $driversPath
wget -r --accept-regex '.*Desktop.*tar' https://vptyp.tech/file/bmd/ || echo "Unable to fetch Driver"
wget -r --accept-regex '.*SDK.*zip' https://vptyp.tech/file/bmd/ || echo "Unable to fetch SDK"
cd $pwd
}
if [[ -e /drivers ]]; then
echo 'Drivers folder existed!'
sdk_name=$(find $driversPath -name "*SDK*zip" -exec basename {} \;)
driver_name=$(find $driversPath -name "*Desktop*tar*" -exec basename {} \;)
if [[ -n $sdk_name && -n $driver_name ]]; then
printf "Found both files names: \n-%s\n-%s\n" $sdk_name $driver_name
else
printf "Wasn't able to found something: \nSDK name - %s\nDriver name - %s\n" $sdk_name $driver_name
fetch_sdk
sdk_name=$(find $driversPath -name "*SDK*zip" -exec basename {} \;)
driver_name=$(find $driversPath -name "*Desktop*tar*" -exec basename {} \;)
fi
fi
if ! command -v unzip >/dev/null 2>&1; then
apt-get update
apt-get install -y zip
fi
if ! command -v tar >/dev/null 2>&1; then
apt-get install -y tar
fi
if [[ -z "$sdk_name" || -z "$driver_name" ]]; then
echo 'Failed to find drivers'
exit 1
fi
cd /drivers
unzip ./$sdk_name -d sdk
mkdir driver
tar -xvzf ./$driver_name -C driver
cd ./driver/*/deb/x86_64/
apt-get install -y libjpeg62 libgl1-mesa-glx libxml2
apt-get install -y ./desktopvideo_*.deb