From 647d61c4e1dbf854930ed1b1ecb3a192d78f9943 Mon Sep 17 00:00:00 2001 From: Jesus Alvarez Date: Mon, 31 Jul 2017 03:18:04 -0700 Subject: [PATCH] WIP more customizing of the test archiso It is now possible to connect via ssh for test. --- archiso/airootfs/root/customize_airootfs.sh | 10 +++++++++- archiso/build.sh | 2 ++ conf.sh | 5 +++++ testing/files/25-wired.network | 7 +++++++ testing/test.sh | 10 +++++++++- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 testing/files/25-wired.network diff --git a/archiso/airootfs/root/customize_airootfs.sh b/archiso/airootfs/root/customize_airootfs.sh index bf5210c..73742cd 100755 --- a/archiso/airootfs/root/customize_airootfs.sh +++ b/archiso/airootfs/root/customize_airootfs.sh @@ -9,8 +9,14 @@ ln -sf /usr/share/zoneinfo/UTC /etc/localtime usermod -s /usr/bin/zsh root cp -aT /etc/skel/ /root/ +mkdir -p /root/.ssh + +cat /root/sshpubkey > /root/.ssh/authorized_keys +chmod 600 /root/.ssh/authorized_keys chmod 700 /root +echo "root:azfstest" | chpasswd + sed -i 's/#\(PermitRootLogin \).\+/\1yes/' /etc/ssh/sshd_config sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf @@ -19,5 +25,7 @@ sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' /etc/systemd/logind.conf sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' /etc/systemd/logind.conf sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf -systemctl enable pacman-init.service choose-mirror.service +cp /root/25-wired.network /etc/systemd/network/25-wired.network + +systemctl enable systemd-networkd sshd pacman-init.service choose-mirror.service systemctl set-default multi-user.target diff --git a/archiso/build.sh b/archiso/build.sh index 13b1fb5..be5e01b 100755 --- a/archiso/build.sh +++ b/archiso/build.sh @@ -106,6 +106,8 @@ make_customize_airootfs() { lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/${arch}/airootfs/root/install.txt setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -r '/root/customize_airootfs.sh' run + rm ${work_dir}/${arch}/airootfs/root/sshpubkey + rm ${work_dir}/${arch}/airootfs/root/25-wired.network rm ${work_dir}/${arch}/airootfs/root/customize_airootfs.sh } diff --git a/conf.sh b/conf.sh index 1d3ec9d..1a6de79 100644 --- a/conf.sh +++ b/conf.sh @@ -29,3 +29,8 @@ package_backup_dir="/data/pacman/repo/archive_archzfs" # Used to run mkaurball and mksrcinfo with lower privledges makepkg_nonpriv_user="demizer" + +# For embedding in the archiso for testing +ssh_public_key_file="/home/demizer/.ssh/id_rsa_demizer_alvaone_2015-04-12.pub" +azfstest_static_ip="192.168.1.100\/24" +azfstest_gateway="192.168.1.1" diff --git a/testing/files/25-wired.network b/testing/files/25-wired.network new file mode 100644 index 0000000..e1b5fb4 --- /dev/null +++ b/testing/files/25-wired.network @@ -0,0 +1,7 @@ +[Match] +Name=ens3 + +[Network] +Address= +Gateway= + diff --git a/testing/test.sh b/testing/test.sh index f8d5b34..0cd3c1e 100755 --- a/testing/test.sh +++ b/testing/test.sh @@ -194,12 +194,17 @@ if [[ "${test_mode}" != "" ]]; then # msg2 "Using packer to build the base image ..." # # Base files + run_cmd_no_dry_run "cp -vf '${ssh_public_key_file}' '${script_dir}/../archiso/airootfs/root/sshpubkey'" + run_cmd_no_dry_run "cp -vf '${script_dir}/files/25-wired.network' '${script_dir}/../archiso/airootfs/root/25-wired.network'" + run_cmd_no_dry_run "sed -i 's/\\(Address=\\)$/\\1${azfstest_static_ip}/' '${script_dir}/../archiso/airootfs/root/25-wired.network'" + run_cmd_no_dry_run "sed -i 's/\\(Gateway=\\)$/\\1${azfstest_gateway}/' '${script_dir}/../archiso/airootfs/root/25-wired.network'" + run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/tests/archzfs-qemu-base/packages' '${vm_work_dir}/packages'" # run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/tests/archzfs-qemu-base/packer.json' '${vm_work_dir}/packer.json'" # run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/tests/archzfs-qemu-base/setup.sh' '${vm_work_dir}/setup.sh'" # run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/../lib.sh' '${vm_work_dir}/lib.sh'" # run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/../conf.sh' '${vm_work_dir}/archzfs-conf.sh'" - # run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/files/poweroff.timer' '${vm_work_dir}/poweroff.timer'" + run_cmd_no_output_no_dry_run "check_symlink '${script_dir}/files/poweroff.timer' '${vm_work_dir}/poweroff.timer'" # # Test files # run_cmd_no_output_no_dry_run "check_symlink '${test_mode}/archiso.sh' '${vm_work_dir}/test-archiso.sh'" @@ -229,6 +234,9 @@ if [[ "${test_mode}" != "" ]]; then # msg "Moving the compiled base image" # run_cmd "mv -f ${base_image_output_dir}/output-qemu/packer-qemu ${base_image_path}" + run_cmd_no_dry_run "rm -rf '${script_dir}/../archiso/airootfs/root/sshpubkey'" + run_cmd_no_dry_run "rm -rf '${script_dir}/../archiso/airootfs/root/25-wired.network'" + msg "Resetting ownership" run_cmd "chown -R ${makepkg_nonpriv_user}: '${vm_work_dir}'"