mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-22 15:30:09 +00:00
improved HD creator with partioning and formatting Drive with HFS. (#51)
This commit is contained in:
parent
f907e85b55
commit
524f1c7826
102
easyinstall.sh
102
easyinstall.sh
@ -4,8 +4,26 @@
|
|||||||
# Author @sonique6784
|
# Author @sonique6784
|
||||||
# Copyright (c) 2020, sonique6784
|
# Copyright (c) 2020, sonique6784
|
||||||
|
|
||||||
|
function showRaSCSILogo(){
|
||||||
|
logo="""
|
||||||
|
.~~. .~~.\n
|
||||||
|
'. \ ' ' / .'\n
|
||||||
|
.╔═══════╗.\n
|
||||||
|
: ║|¯¯¯¯¯|║ :\n
|
||||||
|
~ (║|_____|║) ~\n
|
||||||
|
( : ║ . __ ║ : )\n
|
||||||
|
~ .╚╦═════╦╝. ~\n
|
||||||
|
( ¯¯¯¯¯¯¯ ) RaSCSI Assistant\n
|
||||||
|
'~ .~~~. ~'\n
|
||||||
|
'~'\n
|
||||||
|
"""
|
||||||
|
echo -e $logo
|
||||||
|
}
|
||||||
|
|
||||||
VIRTUAL_DRIVER_PATH=/home/pi/images
|
VIRTUAL_DRIVER_PATH=/home/pi/images
|
||||||
|
HFS_FORMAT=/usr/bin/hformat
|
||||||
|
HFDISK_BIN=/usr/bin/hfdisk
|
||||||
|
LIDO_DRIVER=~/RASCSI/lido-driver.img
|
||||||
|
|
||||||
|
|
||||||
function initialChecks() {
|
function initialChecks() {
|
||||||
@ -17,6 +35,7 @@ function initialChecks() {
|
|||||||
|
|
||||||
if [ ! -d ~/RASCSI ]; then
|
if [ ! -d ~/RASCSI ]; then
|
||||||
echo "You must checkout RASCSI repo into /user/pi/RASCSI"
|
echo "You must checkout RASCSI repo into /user/pi/RASCSI"
|
||||||
|
echo "$ git clone git@github.com:akuker/RASCSI.git"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -109,7 +128,7 @@ function showRaScsiStatus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createDrive600MB() {
|
function createDrive600MB() {
|
||||||
createDrive 600
|
createDrive 600 "HD600"
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDriveCustom() {
|
function createDriveCustom() {
|
||||||
@ -117,29 +136,92 @@ function createDriveCustom() {
|
|||||||
until [ $driveSize -ge "10" ] && [ $driveSize -le "4000" ]; do
|
until [ $driveSize -ge "10" ] && [ $driveSize -le "4000" ]; do
|
||||||
echo "What drive size would you like (in MB) (10-4000)"
|
echo "What drive size would you like (in MB) (10-4000)"
|
||||||
read driveSize
|
read driveSize
|
||||||
|
|
||||||
|
echo "How would you like to name that drive?"
|
||||||
|
read driveName
|
||||||
done
|
done
|
||||||
|
|
||||||
createDrive $driveSize
|
createDrive $driveSize "$driveName"
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDrive() {
|
||||||
|
diskPath="$1"
|
||||||
|
volumeName="$2"
|
||||||
|
|
||||||
|
if [ ! -x $HFS_FORMAT ]; then
|
||||||
|
# Install hfsutils to have hformat to format HFS
|
||||||
|
sudo apt-get install hfsutils
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x $HFDISK_BIN ]; then
|
||||||
|
# Clone, compile and install 'hfdisk', partition tool
|
||||||
|
git clone git://www.codesrc.com/git/hfdisk.git
|
||||||
|
cd hfdisk
|
||||||
|
make
|
||||||
|
|
||||||
|
sudo cp hfdisk /usr/bin/hfdisk
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Inject hfdisk commands to create Drive with correct partitions
|
||||||
|
(echo i; echo ; echo C; echo ; echo 32; echo "Driver_Partition"; echo "Apple_Driver"; echo C; echo ; echo ; echo "${volumeName}"; echo "Apple_HFS"; echo w; echo y; echo p;) | $HFDISK_BIN "$diskPath"
|
||||||
|
partitionOk=$?
|
||||||
|
|
||||||
|
if [ $partitionOk -eq 0 ]; then
|
||||||
|
if [ ! -f $LIDO_DRIVER ];then
|
||||||
|
echo "Lido driver couldn't be found. Make sure RASCSI is up-to-date with git pull"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Burn Lido driver to the disk
|
||||||
|
dd if=$LIDO_DRIVER of="$diskPath" seek=64 count=32 bs=512 conv=notrunc
|
||||||
|
|
||||||
|
driverInstalled=$?
|
||||||
|
if [ $driverInstalled -eq 0 ]; then
|
||||||
|
# Format the partition with HFS file system
|
||||||
|
$HFS_FORMAT -l "${volumeName}" "$diskPath" 1
|
||||||
|
hfsFormattedOk=$?
|
||||||
|
if [ $hfsFormattedOk -eq 0 ]; then
|
||||||
|
echo "Disk created with success."
|
||||||
|
else
|
||||||
|
echo "Unable to format HFS partition."
|
||||||
|
return 4
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Unable to install Lido Driver."
|
||||||
|
return 3
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Unable to create the partition."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDrive() {
|
function createDrive() {
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo "To create a Drive, volume size and volume name must be provided"
|
||||||
|
echo "$ createDrive 600 \"RaSCSI Drive\""
|
||||||
|
echo "Drive wasn't created."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
driveSize=$1
|
driveSize=$1
|
||||||
|
driveName=$2
|
||||||
mkdir -p $VIRTUAL_DRIVER_PATH
|
mkdir -p $VIRTUAL_DRIVER_PATH
|
||||||
drivePath="${VIRTUAL_DRIVER_PATH}/${driveSize}MB.hda"
|
drivePath="${VIRTUAL_DRIVER_PATH}/${driveSize}MB.hda"
|
||||||
echo $drivePath
|
|
||||||
if [ ! -f $drivePath ]; then
|
if [ ! -f $drivePath ]; then
|
||||||
echo "Creating a ${driveSize}MB Drive"
|
echo "Creating a ${driveSize}MB Drive"
|
||||||
dd if=/dev/zero of=$drivePath bs=1M count=$driveSize
|
dd if=/dev/zero of=$drivePath bs=1M count=$driveSize
|
||||||
|
|
||||||
|
echo "Formatting drive with HFS"
|
||||||
|
formatDrive "$drivePath" "$driveName"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Error: drive already exists"
|
echo "Error: drive already exists"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showMenu() {
|
||||||
initialChecks
|
|
||||||
|
|
||||||
|
|
||||||
echo "Welcome to Easy Install for RaSCSI"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Choose among the following options:"
|
echo "Choose among the following options:"
|
||||||
echo "INSTALL"
|
echo "INSTALL"
|
||||||
@ -204,5 +286,9 @@ case $choice in
|
|||||||
createDriveCustom
|
createDriveCustom
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
showRaSCSILogo
|
||||||
|
initialChecks
|
||||||
|
showMenu
|
BIN
lido-driver.img
Normal file
BIN
lido-driver.img
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user