You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
medicat_installer/Medicat_Installer.sh

109 lines
3.4 KiB
Bash

#!/bin/bash
echo -e "WELCOME TO THE MEDICAT INSTALLER, PLEASE DO NOT RUN THIS AS ROOT\nThis Installer will attempt to Install Ventoy and Medicat\nTHIS IS IN BETA. PLEASE CONTACT MATT IN THE DISCORD FOR ALL ISSUES"
echo "Updated for efficiency and cross-distro use by SkeletonMan"
echo "Waiting for 10 seconds"
2 years ago
sleep 10
if grep -qs "ubuntu" /etc/os-release; then
os="ubuntu"
pkgmgr="apt"
elif grep -qs "freebsd" /etc/os-release; then
os="freebsd"
pkgmgr="pkg"
elif [[ -e /etc/debian_version ]]; then
os="debian"
pkgmgr="apt"
elif [[ -e /etc/almalinux-release || -e /etc/rocky-release || -e /etc/centos-release ]]; then
os="centos"
pkgmgr="yum"
elif [[ -e /etc/fedora-release ]]; then
os="fedora"
pkgmgr="yum"
fi
echo "Acquiring any dependencies"
sudo $pkgmgr update
if ! [ $(which aria2c 2>/dev/null) ]; then
sudo $pkgmgr install aria2
fi
if ! [ $(which wget 2>/dev/null) ]; then
sudo $pkgmgr install wget
fi
if ! [ $(which 7z 2>/dev/null) ]; then
sudo $pkgmgr install p7zip-full
fi
if ! [ $(sudo which mkntfs 2>/dev/null) ]; then
sudo $pkgmgr install ntfs-3g
fi
echo "Downloading Ventoy"
2 years ago
wget "https://api.github.com/repos/ventoy/Ventoy/releases/latest"
cat latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' >> version
venver=$(cat version)
rm version
rm latest
echo -e "Attempting to download Ventoy Version: ${venver: -6}\n\n\n"
wget https://github.com/ventoy/Ventoy/releases/download/v${venver: -6}/ventoy-${venver: -6}-linux.tar.gz -O ventoy.tar.gz
tar -xf ventoy.tar.gz
rm ventoy.tar.gz
mv ventoy-${venver: -6} ventoy
echo -e "\n\n\n\n\n\n"
if [[ -f MediCat.USB.v21.12.7z ]]; then
location='MediCat.USB.v21.12.7z'
fi
if ! [[ -f MediCat.USB.v21.12.7z ]]; then
if [[ -f MediCat\ USB\ v21.12/MediCat.USB.v21.12.7z ]]; then
location=''MediCat\ USB\ v21.12/MediCat.USB.v21.12.7z''
else
echo "Please enter location of MediCat.USB.v21.12.7z if it exists or just press enter"
read location
fi
if [ -z "$location" ] ; then
echo "Starting to download torrent"
wget https://cdn.medicatusb.com/files/install/download/MediCat_USB_v21.12.torrent -O medicat.torrent
aria2c --file-allocation=none --seed-time=0 medicat.torrent
location=''MediCat\ USB\ v21.12/MediCat.USB.v21.12.7z''
fi
fi
echo -e "\n\n\n"
2 years ago
echo "Please Plug your USB in now if it is not already"
echo "Waiting 5 seconds..."
sleep 5
2 years ago
echo "Please Find the ID of your USB below"
echo -e "\n\n"
lsblk | awk '{print $1,$4}'
2 years ago
echo "Enter the Letter of the USB drive below NOT INCLUDING /dev/ OR the Number After"
echo "for example enter sda or sdb"
read letter
drive=/dev/$letter
drive2="$drive""1"
echo "You want to install Ventoy and Medicat to $drive / $drive2?"
echo "Please enter Y or N"
read checkingconfirm
if [ $checkingconfirm = "N" ]; then
exit
elif [ $checkingconfirm = "Y" ]; then
echo "Okay! Will continue in 5 seconds!"
sleep 5
else
echo "The only valid options are Y or N"
exit
fi
2 years ago
sudo sh ./ventoy/Ventoy2Disk.sh -I $drive
umount $drive
sudo mkntfs --fast --label Medicat $drive2
if ! [[ -d MedicatUSB/ ]] ; then
mkdir MedicatUSB
2 years ago
fi
sudo mount $drive2 ./MedicatUSB
2 years ago
7z x -O./USB "$location"
echo "MedicatUSB has been created!"
echo "Would you like to unmount ./USB? (Y/N)"
read unmountcheck
if [ $unmountcheck = "Y" ]; then
echo "MedicatUSB will be unmounted!"
sudo umount ./MedicatUSB
elif [ $unmountcheck = "N" ]; then
echo "MedicatUSB will not be unmounted!"
else
"The only valid options are Y or N"
fi