From: Ian Kelling Date: Wed, 16 Nov 2016 17:45:44 +0000 (-0800) Subject: add devbyid dependency X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=3f252d6d03ae2a7c85e852d5ebe24ac59a4dcd25;p=automated-distro-installer add devbyid dependency --- diff --git a/arch-init-remote b/arch-init-remote index 5bcfc3b..ceb3081 100755 --- a/arch-init-remote +++ b/arch-init-remote @@ -45,7 +45,7 @@ faid=/a/bin/fai rsync -rlpthvi --relative /a/bin/fai/ root@$host:/ rsync /a/bin/fai/ root@$host:/a/bin/fai/ -sudo scp -r /a/bin/devbyid /q/root/luks /q/root/shadow root@$host: +sudo scp -r /a/bin/fai/devbyid /q/root/luks /q/root/shadow root@$host: # creating shadow file string: # on debian, you can use mkpasswd -m sha-512 to generate a pass. # arch doesn't have this program. instead, you can do passwd, diff --git a/devbyid b/devbyid new file mode 100755 index 0000000..ecf4988 --- /dev/null +++ b/devbyid @@ -0,0 +1,19 @@ +#!/bin/bash + +# input eg: /dev/sda1 or /dev/sda +# output: /dev/disk/by-id/model+serial, or if no link exists, the same as input + +short_dev=$1 # i.e. + +# devices are identified by model+serial num, +# and wwn. model+serial gives me more info, so use that. +shopt -s extglob +for id in /dev/disk/by-id/!(wwn*); do + [[ -e $id ]] || break # if we matched nothing + if [[ $(readlink -f $id) == "$short_dev" ]]; then + printf '%s\n' "$id" + exit + fi +done +# a vm may not have a by-id link. +printf '%s\n' "$short_dev" diff --git a/fai-redep b/fai-redep index 6552fe3..ca8fb60 100755 --- a/fai-redep +++ b/fai-redep @@ -41,7 +41,7 @@ scp -q ~/.ssh/id_rsa.pub \ # these files are not exposed. s scp -qr /q/root/luks /q/root/shadow \ root@$faiserver_host:/srv/fai/config/distro-install-common -scp -q /a/bin/devbyid root@$faiserver_host:/srv/fai/nfsroot/usr/local/bin +scp -q /a/bin/fai/devbyid root@$faiserver_host:/srv/fai/nfsroot/usr/local/bin # built BELANOS basefile with mk-basefile -J BELENOS64. it's stored in # it's own repo which is published alongside this one called