diff --git a/install.sh b/install.sh index 6c9efb2..72e5026 100755 --- a/install.sh +++ b/install.sh @@ -16,6 +16,13 @@ if [ "$answer" != "y" ]; then exit 1 fi +echo "=> Please enter the full path to the block device the installation should take place on: (e.g. /dev/sda)" +echo " Make sure to choose a drive, not a partition." +echo " Hint: here's a list of devices that may be the right:" +ls /dev/sd* /dev/mmc* 2>/dev/null +echo -n "Install to: " +read blockdevice + for check in checks/*.check do echo "=> Running check '$check'..." @@ -26,3 +33,14 @@ do exit fi done + +for step in steps/*.step +do + echo "=> Running step '$step'..." + $($step) + return=$? + if [ "$return" -ne 0 ]; then + echo "=> Step failed. That is weird. Sorry. Check logs maybe." + exit + fi +done diff --git a/steps/10-wipe.step b/steps/10-wipe.step new file mode 100644 index 0000000..1b9c9d8 --- /dev/null +++ b/steps/10-wipe.step @@ -0,0 +1,12 @@ +#!/bin/sh + +echo "~> Going to wipe $blockdevice. You sure? (y/N) " +read answer + +if [ "$answer" == "y" ]; then + echo "~> OK. Be patient now, that could take some time..." + dd if=/dev/zero of=$blockdevice status=progress + return $? +else + exit 1 +fi diff --git a/steps/20-partition.step b/steps/20-partition.step new file mode 100644 index 0000000..1a04b5d --- /dev/null +++ b/steps/20-partition.step @@ -0,0 +1,15 @@ +#!/bin/sh + +echo "~> Setting up $blockdevice with:" +echo " * 300M EFI (FAT32) partition" +echo " * crypted (LUKS) root (EXT4) partition" + +echo "g\nn\n1\n2048\n+300M\nn\n2\n\n\np\nw" + +if [ "$?" -eq 0 ]; then + echo "~> Seems to have worked. Yay!" + exit 0 +else + echo "~> Failed. :(" + exit 1 +fi