X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=arch-init;h=36b77c6b6851ca851b48949abf9db399ff3c39f4;hb=2e975979fa5bad84f3d2a84a9d62fbfd8793374c;hp=a9e5d68c49c38e6f3e5771bd2bdfbb671101712e;hpb=81e0e0b826ebffdee7d809ee4dff1338af7692e1;p=automated-distro-installer diff --git a/arch-init b/arch-init index a9e5d68..36b77c6 100755 --- a/arch-init +++ b/arch-init @@ -7,15 +7,9 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR cd $(dirname $(readlink -f "$BASH_SOURCE")) -ROOTPW="$(cat /root/shadow/standard)" -export ROOTPW -export hostname="$1" +export HOSTNAME="$1" mirror=$2 TPPASS="$(cat /root/shadow/traci-simple)" -export TPPASS -if [[ $hostname == tp ]]; then - ROOTPW="$TPPASS" -fi (( $# >= 1 )) || { echo "$0: error: need 1 or 2 arguments"; exit 1; } @@ -30,19 +24,12 @@ fi curl -s 'https://www.archlinux.org/mirrorlist/?country=US&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on' | sed -r 's/^[ #]*(Server *=)/\1/' >> /etc/pacman.d/mirrorlist -# export class vars with CLASS_ in front to avoid name colissions. -ifclass() { - local var=${1/#/CLASS_} - [[ $hostname == $1 || ${!var} ]] -} -export -f ifclass -for x in $(bash 50-host-classes); do - export CLASS_$x=true -done +. /a/bin/fai/fai-wrapper export LUKS_DIR=/root/luks export HOSTNAME=$hostname export DISTRO=arch -chmod +x partition.DEFAULT +partition_script=/a/bin/fai/fai/config/hooks/partition.DEFAULT +chmod +x $partition_script export PARTITION_PROMPT=true @@ -58,7 +45,7 @@ for dir in /mnt{,/home,/boot,/q}; do done if ! $already_partitioned; then - ./partition.DEFAULT + /a/bin/fai/fai/config/hooks/partition.DEFAULT fi . /tmp/fai/disk_var.sh @@ -76,7 +63,6 @@ if ! $already_partitioned; then mount -o subvol=root_$DISTRO $ROOT_PARTITION /mnt mkdir -p /mnt/{q,home,boot} mount -o subvol=q $ROOT_PARTITION /mnt/q - mount -o subvol=home_$DISTRO $ROOT_PARTITION /mnt/home mount -o subvol=boot_$DISTRO $BOOT_PARTITION /mnt/boot fi @@ -91,14 +77,25 @@ they will succeed using the secodary mirror" fi pacstrap /mnt base cp /tmp/fai/{fstab,crypttab} /mnt/etc -cp /root/encrypt /mnt/usr/lib/initcpio/hooks +cp /a/bin/fai/encrypt /mnt/usr/lib/initcpio/hooks # not needed anymore #cp /usr/bin/devbyid /mnt/root -cp -r .ssh /mnt/root -cp -r /root/distro-install-common /mnt/root +cp -r /root/.ssh /mnt/root + +bindmount() { + local mountpoint=$2 + local source=$1 + mkdir -p $mountpoint + mount -o bind $source $mountpoint +} +bindmount /a /mnt/a +bindmount /root/shadow /mnt/q/root/shadow + +mkdir -p /mnt/etc/ssh +cp /etc/ssh/ssh_host_* /mnt/etc/ssh -cp /root/arch-init-chroot /mnt/root +cp /a/bin/fai/arch-init-chroot /mnt/root # for manual commands, arch-chroot /mnt bash arch-chroot /mnt /root/arch-init-chroot