Skip to content

Commit

Permalink
clea up and fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotsor committed Feb 19, 2017
1 parent 1709d8a commit dc6f5fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/latest-iso-minimal-x86_64-linux
/latest-iso-graphical-x86_64-linux
/nixos-in-place-test
*.iso
*.iso
13 changes: 6 additions & 7 deletions install
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash

set -eu

Expand Down Expand Up @@ -28,9 +28,9 @@ log_end "seems sane"
root_mount=$(mount | grep "/ " | sed 's/ /\n/' | head -n1)
root_type=$(mount | grep -Eo "/ type \w+" | sed 's/ /\n/g' | tail -n1)

the_only_line() {
ERROR_MESSAGE_ZERO=$0
ERROR_MESSAGE_MULTIPLE=$1
expect_one_line() {
ERROR_MESSAGE_ZERO=$1
ERROR_MESSAGE_MULTIPLE=$2
(set -eu;
IFS='' read -r x || (echo "$ERROR_MESSAGE_ZERO" >& 2; exit 1)
(! IFS='' read -r) || (echo "$ERROR_MESSAGE_MULTIPLE" >& 2; exit 1)
Expand All @@ -44,7 +44,7 @@ if [ -d /sys/firmware/efi ]; then
fdisk -l -o 'Device,Type' |
grep 'EFI System' |
sed -r 's_([^ ]*) *EFI System$_\1_' |
the_only_line \
expect_one_line \
"Fdisk found no EFI System Partitions: please specify with -g option" \
"Found multiple EFI System Partitions: please specify with -g option")
else
Expand All @@ -56,8 +56,7 @@ else
elif grep '/dev/vd' <<< "$root_mount"; then
boot_device=$(echo "$root_mount" | sed "s|[0-9]\+||");
else
echo "Unable to determine your grub boot device! \
Please specify with the -g option."
echo "Unable to determine your grub boot device! Please specify with the -g option."
fi
fi
working_directory=$(mktemp -d)
Expand Down

0 comments on commit dc6f5fe

Please sign in to comment.