summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-09-26 12:12:26 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-09-26 12:12:26 -0300
commit96e21d9866cfc7b853f5cb8728ff2f7d7409ea84 (patch)
treed2bbe49d5b94a69546086530e34c86482c52921e
parent52ecfc3590fc33bff702ec1478ac61378639c849 (diff)
downloadhydra-96e21d9866cfc7b853f5cb8728ff2f7d7409ea84.tar.gz
hydra-96e21d9866cfc7b853f5cb8728ff2f7d7409ea84.tar.bz2
Provision fixes for raspi
-rw-r--r--lib/hydra/provision48
-rwxr-xr-xshare/hydra/provision3
l---------share/hydra/provision-raspi1
-rwxr-xr-xshare/hydractl/provision8
-rwxr-xr-xshare/hydractl/provision-raspi16
5 files changed, 46 insertions, 30 deletions
diff --git a/lib/hydra/provision b/lib/hydra/provision
index 5c85e04..1c24129 100644
--- a/lib/hydra/provision
+++ b/lib/hydra/provision
@@ -1,31 +1,31 @@
#!/bin/bash
# Load provision configuration
-function hydra_provision_load_config {
-if [ ! -z "$1" ]; then
- if [ -f "$1" ]; then
- echo "Using configuration from file $1..."
- source "$1"
- elif [ -f "$1.conf" ]; then
- echo "Using configuration from file $1.conf..."
- source "$1.conf"
- elif [ -f "$HYDRA_FOLDER/config/provision/$1" ]; then
- echo "Using configuration from $HYDRA_FOLDER/config/provision/$1..."
- source "$HYDRA_FOLDER/config/provision/$1"
- elif [ -f "$HYDRA_FOLDER/config/provision/$1.conf" ]; then
- echo "Using configuration from $HYDRA_FOLDER/config/provision/$1.conf..."
- source "$HYDRA_FOLDER/config/provision/$1.conf"
- elif [ -f "$APP_BASE/share/config/provision/$1" ]; then
- echo "Using configuration from $APP_BASE/share/config/provision/$1..."
- source "$APP_BASE/share/config/provision/$1"
- elif [ -f "$APP_BASE/share/config/provision/$1.conf" ]; then
- echo "Using configuration from $APP_BASE/share/config/provision/$1.conf..."
- source "$APP_BASE/share/config/provision/$1.conf"
- else
- echo "Profile not found: $1"
- exit 1
+function hydra_provision_config_load {
+ if [ ! -z "$1" ]; then
+ if [ -f "$1" ]; then
+ echo "Using configuration from file $1..."
+ source "$1"
+ elif [ -f "$1.conf" ]; then
+ echo "Using configuration from file $1.conf..."
+ source "$1.conf"
+ elif [ -f "$HYDRA_FOLDER/config/provision/$1" ]; then
+ echo "Using configuration from $HYDRA_FOLDER/config/provision/$1..."
+ source "$HYDRA_FOLDER/config/provision/$1"
+ elif [ -f "$HYDRA_FOLDER/config/provision/$1.conf" ]; then
+ echo "Using configuration from $HYDRA_FOLDER/config/provision/$1.conf..."
+ source "$HYDRA_FOLDER/config/provision/$1.conf"
+ elif [ -f "$APP_BASE/share/config/provision/$1" ]; then
+ echo "Using configuration from $APP_BASE/share/config/provision/$1..."
+ source "$APP_BASE/share/config/provision/$1"
+ elif [ -f "$APP_BASE/share/config/provision/$1.conf" ]; then
+ echo "Using configuration from $APP_BASE/share/config/provision/$1.conf..."
+ source "$APP_BASE/share/config/provision/$1.conf"
+ else
+ echo "Profile not found: $1"
+ exit 1
+ fi
fi
-fi
}
# Networking.
diff --git a/share/hydra/provision b/share/hydra/provision
index 99ee291..4c59b3d 100755
--- a/share/hydra/provision
+++ b/share/hydra/provision
@@ -23,6 +23,7 @@ hydra_config_load
# Parameters
NODE="$1"
CONFIG="$HYDRA_FOLDER/config/provision"
+BASENAME="`basename $0`"
# Ensure config folder exists
mkdir -p $CONFIG
@@ -33,5 +34,5 @@ if [ -z "$NODE" ]; then
( cd $CONFIG && tree )
exit 1
else
- hydractl provision $NODE
+ hydractl $BASENAME $NODE
fi
diff --git a/share/hydra/provision-raspi b/share/hydra/provision-raspi
new file mode 120000
index 0000000..e98b45a
--- /dev/null
+++ b/share/hydra/provision-raspi
@@ -0,0 +1 @@
+provision \ No newline at end of file
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 79c88cc..087b703 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -109,10 +109,16 @@ function hydra_provision_config {
hydra_user_config vg $hostname "Install vg"
hydra_user_config grub y "Setup GRUB? (y/n)"
hydra_user_config mirror http://http.debian.net/debian/ "Debian mirror"
+
+ # Check arch
+ if [ "$arch" == "armel" ] || [ "$arch" == "armhf" ]; then
+ echo "You probably want to run provision-raspi instead of provision"
+ exit 1
+ fi
}
# Load configuration
-hydra_provision_load_config
+hydra_provision_config_load $1
# Parameters
WORK="/tmp/debootstrap"
diff --git a/share/hydractl/provision-raspi b/share/hydractl/provision-raspi
index 640616f..5b3ea15 100755
--- a/share/hydractl/provision-raspi
+++ b/share/hydractl/provision-raspi
@@ -29,23 +29,31 @@ function hydra_provision_config {
hydra_user_config arch armel "System arch"
hydra_user_config version jessie "Distro version"
hydra_user_config mirror http://http.debian.net/debian/ "Debian mirror"
+
+ # Check arch
+ if [ "$arch" != "armel" ] && [ "$arch" != "armhf" ]; then
+ echo "You probably want to run provision instead of provision-raspi"
+ exit 1
+ fi
}
# Load configuration
-hydra_provision_load_config
+hydra_provision_config_load $1
# Parameters
WORK="/media/mmc"
CHROOT="hydra_sudo_run chroot $WORK"
CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
-RPI_URL="http://goo.gl/1BOfJ"
+RPI_URL="https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update"
# Get config parameters.
hydra_provision_config
# Partitioning
-# TODO automated
-hydra_sudo_run cfdisk $device # bootable VFAT (0B) and linux partitions
+hydra_sudo_run parted -s -- $device mklabel msdos
+hydra_sudo_run parted -s -- $device unit MB mkpart primary fat32 1 100
+hydra_sudo_run parted -s -- $device unit MB mkpart primary ext2 101 -1
+hydra_sudo_run parted -s -- $device set 1 boot on
hydra_sudo_run mkdir -p $WORK
# Create filesystems