Commit 202fd34a authored by Dan Johansen's avatar Dan Johansen

added some sanity checks and dependencies

parent 0ed6ab00
...@@ -6,15 +6,17 @@ This script is "interactive". Meaning that it asks you questions when run to cus ...@@ -6,15 +6,17 @@ This script is "interactive". Meaning that it asks you questions when run to cus
## Dependencies: ## Dependencies:
* bash
* wget * wget
* git * git
* systemd * systemd
* dialog * dialog
* parted
* libarchive
## Installing: ## Installing:
To use this script, please make sure that the following is correct: To use this script, please make sure that the following is correct:
* your default Shell is Bash.
* an SD card with at least 4 GB storage is plugged in. * an SD card with at least 4 GB storage is plugged in.
## Known Issues: ## Known Issues:
...@@ -24,7 +26,7 @@ To use this script, please make sure that the following is correct: ...@@ -24,7 +26,7 @@ To use this script, please make sure that the following is correct:
To use this script, simple run it as normal user after you make it executable: To use this script, simple run it as normal user after you make it executable:
``` ```
chmod +x manjaro-arm-installer chmod +x manjaro-arm-installer
./manjaro-arm-installer bash /manjaro-arm-installer
``` ```
## Other notes: ## Other notes:
......
...@@ -13,6 +13,31 @@ PASSWORD="" ...@@ -13,6 +13,31 @@ PASSWORD=""
ROOTPASSWORD="" ROOTPASSWORD=""
SDCARD="" SDCARD=""
# Sanity checks for dependencies
if [ ! -f /usr/bin/sudo ]
echo "sudo command is missing! Please install sudo!"
exit 1
elif [ ! -f /usr/bin/git ]
echo "git command is missing! Please install git!"
exit 1
elif [ ! -f /usr/bin/parted ]
echo "parted command is missing! Please install parted!"
exit 1
elif [ ! -f /usr/bin/systemd-nspawn ]
echo "systemd-nspawn command is missing! Please install systemd!"
exit 1
elif [ ! -f /usr/bin/wget ]
echo "wget command is missing! Please install wget!"
exit 1
elif [ ! -f /usr/bin/dialog ]
echo "dialog command is missing! Please install dialog!"
exit 1
elif [ ! -f /usr/bin/bsdtar ]
echo "bsdtar command is missing! Please install libarchive!"
exit 1
fi
# Functions # Functions
msg() { msg() {
...@@ -283,9 +308,9 @@ DEVICE=$(dialog --clear --title "Manjaro ARM Installer" \ ...@@ -283,9 +308,9 @@ DEVICE=$(dialog --clear --title "Manjaro ARM Installer" \
"rpi3" "Raspberry Pi 3" \ "rpi3" "Raspberry Pi 3" \
"oc2" "Odroid C2" \ "oc2" "Odroid C2" \
"pinebook" "PineBook" \ "pinebook" "PineBook" \
"rpi2" "Raspberry Pi 2 (not maintained)" \ "rpi2" "Raspberry Pi 2 (unmaintained)" \
"oc1" "Odroid C1/C1+ (not maintained)" \ "oc1" "Odroid C1/C1+ (unmaintained)" \
"xu4" "Odroid XU4 (not maintained)" 3>&1 1>&2 2>&3 3>&-) "xu4" "Odroid XU4 (unmaintained)" 3>&1 1>&2 2>&3 3>&-)
#The if statement makes sure that the user has put in something in the previous prompt. If not (left blank or pressed cancel) the script will end #The if statement makes sure that the user has put in something in the previous prompt. If not (left blank or pressed cancel) the script will end
...@@ -295,7 +320,7 @@ EDITION=$(dialog --clear --title "Manjaro ARM Installer" \ ...@@ -295,7 +320,7 @@ EDITION=$(dialog --clear --title "Manjaro ARM Installer" \
--menu "Choose an edition:" 20 50 5 \ --menu "Choose an edition:" 20 50 5 \
"minimal" "Minimal Edition (Just CLI)" \ "minimal" "Minimal Edition (Just CLI)" \
"lxqt" "Full LXQT Desktop and apps (lightweight)" \ "lxqt" "Full LXQT Desktop and apps (lightweight)" \
"kde" "Full KDE Desktop (Heavy)" \ "kde" "Full KDE/Plasma Desktop (Heavy)" \
"mate" "Full MATE desktop and apps (lightweight, not maintained)" \ "mate" "Full MATE desktop and apps (lightweight, not maintained)" \
"i3" "Mininal i3 WM with apps (very light)" 3>&1 1>&2 2>&3 3>&-) "i3" "Mininal i3 WM with apps (very light)" 3>&1 1>&2 2>&3 3>&-)
...@@ -356,7 +381,7 @@ while read -r line; do ...@@ -356,7 +381,7 @@ while read -r line; do
W+=($line "") W+=($line "")
done < <( lsblk -adn -o NAME ) done < <( lsblk -adn -o NAME )
SDCARD=$(dialog --title "Manjaro ARM Installer" \ SDCARD=$(dialog --title "Manjaro ARM Installer" \
--menu "Chose your SDCard" 20 50 10 \ --menu "Chose your SDCard - Be sure the correct drive is selected!" 20 50 15 \
"${W[@]}" 3>&2 2>&1 1>&3) "${W[@]}" 3>&2 2>&1 1>&3)
# add /dev/ to the selected option above # add /dev/ to the selected option above
...@@ -367,15 +392,23 @@ else ...@@ -367,15 +392,23 @@ else
fi fi
# List all the responses upon completion (remove this for production) # List all the responses upon completion to be verified
clear clear
echo "Device = $DEVICE" echo "Device = $DEVICE"
echo "Edition = $EDITION" echo "Edition = $EDITION"
echo "User name = $USER" echo "User name = $USER"
echo "Password for $USER = ********** ($PASSWORD)" #password is here for testing purposes echo "Password for $USER = ($PASSWORD)"
echo "Root Password = ********** ($ROOTPASSWORD)" #password is here for testing purposes echo "Root Password = ($ROOTPASSWORD)"
echo "SDCard = $SDCARD" echo "SDCard = $SDCARD"
echo "Are the above settings correct?"
select yn in "Yes" "No"; do
case $yn in
Yes ) echo "Continuing..."; break;;
No ) exit 1;;
esac
done
if [[ "$DEVICE" = "oc1" ]] || [[ "$DEVICE" = "rpi2" ]] || [[ "$DEVICE" = "xu4" ]]; then if [[ "$DEVICE" = "oc1" ]] || [[ "$DEVICE" = "rpi2" ]] || [[ "$DEVICE" = "xu4" ]]; then
ARCH='armv7h' ARCH='armv7h'
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment