diff --git a/build_vm b/build_vm index dee3fbd..8213b0e 100755 --- a/build_vm +++ b/build_vm @@ -79,8 +79,8 @@ main() { assert_value target ${target} alt-server alt-workstation alt-kworkstation assert_value arch ${arch} i586 x86_64 assert_value headless ${headless} true false - assert_value BASE_VERSION ${BASE_VERSION} '8sp' '8sp-yandex' '10' '10.1' '10.2' '10.1-vmware' '10.2-vmware' '10-yandex' '10.1-yandex' 'c10f1' 'c10f1-vmware' 'c10f2' 'c10f2-vmware' 'sisyphus' - assert_value TARGET_VERSION ${TARGET_VERSION} '8sp' '8sp-yandex' '10' '10.1' '10.2' '10.1-vmware' '10.2-vmware' '10-yandex' '10.1-yandex' 'c10f1' 'c10f1-vmware' 'c10f2' 'c10f2-vmware' 'sisyphus' + assert_value BASE_VERSION ${BASE_VERSION} '8sp' '8sp-yandex' '10' '10.1' '10.2' '10.4' '10.1-vmware' '10.2-vmware' '10.4-vmware' '10-yandex' '10.1-yandex' 'c10f1' 'c10f1-vmware' 'c10f2' 'c10f2-vmware' 'sisyphus' + assert_value TARGET_VERSION ${TARGET_VERSION} '8sp' '8sp-yandex' '10' '10.1' '10.2' '10.4' '10.1-vmware' '10.2-vmware' '10.4-vmware' '10-yandex' '10.1-yandex' 'c10f1' 'c10f1-vmware' 'c10f2' 'c10f2-vmware' 'sisyphus' assert_value VM_TYPE ${VM_TYPE} qemu onebula vbox vagrant-qemu vagrant-vbox cloud vsphere openuds-actor assert_value onerror ${onerror} ask cleanup abort diff --git a/config/alt-workstation-10.4-x86_64.json b/config/alt-workstation-10.4-x86_64.json new file mode 100644 index 0000000..60826b8 --- /dev/null +++ b/config/alt-workstation-10.4-x86_64.json @@ -0,0 +1,15 @@ +{ + "iso_url": "http://ftp.altlinux.org/pub/distributions/ALTLinux/p10/images/workstation/x86_64/alt-workstation-10.4-x86_64.iso", + "iso_target_path": "alt-workstation-10.4-x86_64.iso", + "iso_checksum": "bedfda720eeb07f2d6127bbcbc4e16d4", + "iso_checksum_type": "md5", + "boot_escape_cmd": "c", + "boot_cmd": "linux /boot/vmlinuz showopts net.ifnames=0 selinux=0 changedisk automatic=method:cdrom lowmem", + "boot_finish_cmd": "initrd /boot/initrd.imgboot", + "metadata": "alt-workstation-10.4-x86_64", + "descr": "ALT Linux Workstation 10.4 x86_64", + "image_version": "1.0.0", + "with_cloudinit": "1", + "with_sisyphus": "0" +} + diff --git a/metadata/alt-workstation-10.4-x86_64/autoinstall.scm b/metadata/alt-workstation-10.4-x86_64/autoinstall.scm new file mode 100644 index 0000000..120d050 --- /dev/null +++ b/metadata/alt-workstation-10.4-x86_64/autoinstall.scm @@ -0,0 +1,65 @@ +("/sysconfig-base/language" action "write" lang ("ru_RU")) +("/sysconfig-base/kbd" action "write" layout "ctrl_shift_toggle") +; Alterator in p9 prevents from installing "UTC" zone somehow. +("/datetime-installer" action "write" commit #t name "RU" zone "Europe/Moscow" utc #t) + +("/evms/control" action "write" control open installer #t) +("/evms/control" action "write" control update) +; Choices other than "workstation" are not really working. +("/evms/profiles/workstation" action apply commit #f clearall #t exclude ()) +("/evms/control" action "write" control commit) +("/evms/control" action "write" control close) + +("pkg-install-init" action "write") +; Package lists for installation are taken from 'pkg-groups.tar' file +; which originally resides in 'Metadata' directory inside installation +; image/ISO. You may get the idea about necessary packages by +; running installation process with 'instdebug' option passed as +; kernel argument and then looking at '/tmp/wizard.log' script. +; +; Please note that in this case the package group called 'alterator' +; is unavoidable otherwise the '/preinstall' step will go into +; inifinite loop waiting for non-existent 'alteratord' to start in +; chrooted environment. Other package groups may be optional. +; +; It's also advised to avoid installing 'selinux-altlinux-server' package +; group in SELinux-enabled distros because SELinux must be disabled to +; perform 'apt-get dist-upgrade' which you will eventually try to +; perform when VM is up. +; +; SUDDENLY: You won't get Alterator in installed system chroot without +; "/pkg-install" call even if no package lists needed so you MUST invoke +; it every time. +("/pkg-install" action "write" lists "" auto #t) +("/preinstall" action "write") + +; It should be noted that 'virtio' block device driver will render +; device file names as '/dev/vda', not '/dev/sda' under QEMU. Alterator +; is unable to handle errors returned by applications it calls +; internally so you will get unbootable VM in case of device name +; mismatch without any errors. +; +; In this case the driver 'virtio-scsi' is used when building box under +; QEMU which makes devices to look like classic '/dev/sda'. It allows +; to have one 'autoinstall.scm' file for both QEMU and VirtualBox +; reducing duplication, errors and differences. +("/grub" action "write" device "/dev/sda" passwd #f passwd_1 "*" passwd_2 "*") + +("/net-eth" action "write" reset #t) +; There is a problem with 8SP networking - "persistent" interface names +; are turned on by default and there is no 'alterator-postinstall' +; package included in initrd so there is no way to know the network +; interface namem when the system is finally booted. +; +; Here we have settings (enp0s3) for QEMU and (ens4) for VirtualBox +; builds. Please note that you may need to adjust interface names when +; building VMs using this autoinstall scripts. +("/net-eth" action "write" name "eth0" ipv "4" configuration "dhcp" controlled "NetworkManagerNative" search "" dns "" computer_name "c245" ipv_enabled #t) +("/net-eth" action "write" name "enp0s3" ipv "4" configuration "dhcp" controlled "NetworkManagerNative" search "" dns "" computer_name "c245" ipv_enabled #t) +("/net-eth" action "write" commit #t) + +("/root/change_password" language ("ru_RU") passwd_2 "123" passwd_1 "123") + +; There is no sshd available in Workstation by default so we enable it +("/postinstall/laststate" run "cd $(dirname $AUTOINSTALL); cp-metadata autoinstall.sh; bash ./autoinstall.sh; cd -") +("/postinstall/firsttime" run "systemctl enable sshd; systemctl start sshd") diff --git a/metadata/alt-workstation-10.4-x86_64/autoinstall.sh b/metadata/alt-workstation-10.4-x86_64/autoinstall.sh new file mode 100644 index 0000000..48c00cd --- /dev/null +++ b/metadata/alt-workstation-10.4-x86_64/autoinstall.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +dest="$ALTERATOR_DESTDIR" +iface="$(ls -1 /sys/class/net/ | grep -v ^lo$ | head -1)" + +apt-get -y remove virtualbox-guest-common-vboxguest virtualbox-guest-common-vboxvideo virtualbox-common +rm -f /etc/modules-load.d/virtualbox-addition.conf +rm -f $dest/etc/modules-load.d/virtualbox-addition.conf + +mkdir -p "$dest/etc/systemd/system/network.service.d" +echo -e "[Unit]\nRequires=sys-subsystem-net-devices-$iface.device\nAfter=sys-subsystem-net-devices-$iface.device" >$dest/etc/systemd/system/network.service.d/$iface.conf + +echo "PasswordAuthentication yes" >> $dest/etc/openssh/sshd_config +echo "PermitRootLogin yes" >> $dest/etc/openssh/sshd_config diff --git a/metadata/alt-workstation-10.4-x86_64/vm-profile.scm b/metadata/alt-workstation-10.4-x86_64/vm-profile.scm new file mode 100644 index 0000000..ba37e58 --- /dev/null +++ b/metadata/alt-workstation-10.4-x86_64/vm-profile.scm @@ -0,0 +1,7 @@ +((workstation + (title . "Setup for workstation") + (action . trivial) + (actiondata + ("/" (size 20971520 . 20971520 ) (fsim . "Ext2/3") (methods plain)) + ;("/var" (size 1024000 . #t) (fsim . "Ext2/3") (methods plain)) + ))) diff --git a/scripts/steps/setup_minimalize_workstation_10.2 b/scripts/steps/setup_minimalize_workstation_10.2 index 354cda8..293c42f 100755 --- a/scripts/steps/setup_minimalize_workstation_10.2 +++ b/scripts/steps/setup_minimalize_workstation_10.2 @@ -3,7 +3,7 @@ set -euo pipefail echo "Minimalize VM for clouds" apt-get remove -y -D \ - docs-alt-server \ + docs-alt-workstation \ dosfstools \ eject \ fatresize \ diff --git a/scripts/vm_setup b/scripts/vm_setup index f8afa91..b27c6ec 100755 --- a/scripts/vm_setup +++ b/scripts/vm_setup @@ -82,7 +82,7 @@ main() { ${STEP_DIR}/setup_remove_etcnet ${STEP_DIR}/setup_minimalize_server_10.1 ;; - '10.2') + '10.2' | '10.4') ${STEP_DIR}/setup_remove_etcnet if test "${TARGET}" == "alt-workstation"; then ${STEP_DIR}/setup_minimalize_workstation_10.2