From 65a12ecfe2db3f55ba348ddc27ca93daa44e825d Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Sun, 23 Apr 2023 17:25:44 +0800 Subject: [PATCH 01/41] support autoinstall for Pardus Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 234 ++++++++++++++++++ .../deploy_vm/create_unattend_install_iso.yml | 8 +- linux/deploy_vm/deploy_vm_from_iso.yml | 5 + .../rebuild_unattend_install_iso.yml | 86 +++++++ 4 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 autoinstall/Pardus/preseed.cfg diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg new file mode 100644 index 000000000..565dc887f --- /dev/null +++ b/autoinstall/Pardus/preseed.cfg @@ -0,0 +1,234 @@ +#_preseed_V1 +#### Contents of the preconfiguration file (for bullseye) +### Localization +# Preseeding only locale sets language, country and locale. +d-i debian-installer/locale string en_US + +# The values can also be preseeded individually for greater flexibility. +d-i debian-installer/language string en +d-i debian-installer/country string US +#d-i debian-installer/locale string en_GB.UTF-8 +# Optionally specify additional locales to be generated. +d-i localechooser/supported-locales multiselect en_US.UTF-8 + +# Keyboard selection. +d-i keyboard-configuration/xkb-keymap select us +d-i keyboard-configuration/variant select English (US) + +### Network configuration +# netcfg will choose an interface that has link if possible. This makes it +# skip displaying a list if there is more than one interface. +d-i netcfg/choose_interface select auto +d-i netcfg/use_dhcp string true + +# To set a different link detection timeout (default is 3 seconds). +# Values are interpreted as seconds. +d-i netcfg/link_wait_timeout string 10 + +# If you have a slow dhcp server and the installer times out waiting for +# it, this might be useful. +d-i netcfg/dhcp_timeout string 60 +#d-i netcfg/dhcpv6_timeout string 60 + +# If you want the preconfiguration file to work on systems both with and +# without a dhcp server, uncomment these lines and the static network +# configuration below. +d-i netcfg/dhcp_failed note + +# Any hostname and domain names assigned from dhcp take precedence over +# values set here. However, setting the values still prevents the questions +# from being shown, even if values come from dhcp. +d-i netcfg/get_hostname string unassigned-hostname +d-i netcfg/get_domain string unassigned-domain + +# Disable that annoying WEP key dialog. +d-i netcfg/wireless_wep string + +### Mirror settings +#d-i mirror/country string US +#d-i mirror/http/directory string /debian/ +#d-i mirror/http/hostname string deb.debian.org +#d-i mirror/http/mirror select deb.debian.org +#d-i mirror/no-default boolean true +#d-i mirror/protocol select http +#d-i mirror/http/proxy string + +### Account setup +# Root password encrypted using a crypt(3) hash. +d-i passwd/root-password-crypted password {{ vm_password_hash }} + +{% if new_user is defined and new_user != 'root' %} +# To create a normal user account. +d-i passwd/user-fullname string {{ new_user }} +d-i passwd/username string {{ new_user }} +# Normal user's password encrypted using a crypt(3) hash. +d-i passwd/user-password-crypted password {{ vm_password_hash }} + +# The user account will be added to some standard initial groups. To +# override that, use this. +d-i passwd/user-default-groups string root wheel +{% endif %} + +### Clock and time zone setup +# Controls whether or not the hardware clock is set to UTC. +d-i clock-setup/utc boolean true + +# You may set this to any valid setting for $TZ; see the contents of +# /usr/share/zoneinfo/ for valid values. +d-i time/zone string US/Eastern + +# Controls whether to use NTP to set the clock during the install +d-i clock-setup/ntp boolean true +# NTP server to use. The default is almost always fine here. +#d-i clock-setup/ntp-server string ntp.example.com +d-i console-setup/ask_detect boolean false +d-i console-setup/layoutcode string us + +### Partitioning +## Partitioning example +# Specify a disk to partition. +# For example, to use the first SCSI/SATA hard disk: +d-i partman-auto/disk string /dev/{{ boot_disk_name }} +# In addition, you'll need to specify the method to use. +# The presently available methods are: +# - regular: use the usual partition types for your architecture +# - lvm: use LVM to partition the disk +# - crypto: use LVM within an encrypted partition +d-i partman-auto/method string lvm + +# You can define the amount of space that will be used for the LVM volume +# group. It can either be a size with its unit (eg. 20 GB), a percentage of +# free space or the 'max' keyword. +d-i partman-auto-lvm/guided_size string max + +# If one of the disks that are going to be automatically partitioned +# contains an old LVM configuration, the user will normally receive a +# warning. This can be preseeded away... +d-i partman-lvm/device_remove_lvm boolean true +# The same applies to pre-existing software RAID array: +d-i partman-md/device_remove_md boolean true +# And the same goes for the confirmation to write the lvm partitions. +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +# You can choose one of the three predefined partitioning recipes: +# - atomic: all files in one partition +# - home: separate /home partition +# - multi: separate /home, /var, and /tmp partitions +d-i partman-auto/choose_recipe select atomic + +# This makes partman automatically partition without confirmation, provided +# that you told it what to do using one of the methods above. +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +# Force UEFI booting ('BIOS compatibility' will be lost). Default: false. +{% if firmware is defined and firmware == 'efi' %} +d-i partman-efi/non_efi_system boolean true + +# Ensure the partition table is GPT - this is required for EFI +d-i partman-partitioning/choose_label string gpt +d-i partman-partitioning/default_label string gpt +{% endif %} + +# This makes partman automatically partition without confirmation. +d-i partman-md/confirm boolean true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +## Controlling how partitions are mounted +# The default is to mount by UUID, but you can also choose "traditional" to +# use traditional device names, or "label" to try filesystem labels before +# falling back to UUIDs. +#d-i partman/mount_style select uuid + +### Apt setup +d-i apt-setup/use_mirror boolean false +d-i apt-setup/cdrom/set-first boolean false +d-i apt-setup/cdrom/set-next boolean false +d-i apt-setup/cdrom/set-failed boolean false +d-i apt-setup/disable-cdrom-entries boolean true + +# Don't add any security and updates repo to avoid an upgrade during installation +d-i apt-setup/services-select multiselect +d-i apt-setup/enable-source-repositories boolean false + +### Package selection +#tasksel tasksel/first multiselect standard, web-server, kde-desktop +tasksel tasksel/first multiselect standard, desktop +tasksel tasksel/desktop multiselect gnome + +# Individual additional packages to install +# There is no open-vm-tools-desktop and cloud-init in CDROM +d-i pkgsel/include string build-essential vim locales open-vm-tools openssh-server sg3-utils + +# Policy for applying updates. May be "none" (no automatic updates), +# "unattended-upgrades" (install security updates automatically), or +# "landscape" (manage system with Landscape). +d-i pkgsel/update-policy select none + +# Some versions of the installer can report back on what software you have +# installed, and what software you use. The default is not to report back, +# but sending reports helps the project determine what software is most +# popular and should be included on the first CD/DVD. +popularity-contest popularity-contest/participate boolean false + +### Boot loader installation +# Grub is the boot loader (for x86). + +# This is fairly safe to set, it makes grub install automatically to the UEFI +# partition/boot record if no other operating system is detected on the machine. +d-i grub-installer/only_debian boolean true + +# Due notably to potential USB sticks, the location of the primary drive can +# not be determined safely in general, so this needs to be specified: +#d-i grub-installer/bootdev string /dev/sda +# To install to the primary device (assuming it is not a USB stick): +d-i grub-installer/bootdev string default + +# Avoid that last message about the install being complete. +d-i finish-install/reboot_in_progress note + +# This will prevent the installer from ejecting the CD during the reboot, +# which is useful in some situations. +#d-i cdrom-detect/eject boolean false + +### Preseeding other packages +# Depending on what software you choose to install, or if things go wrong +# during the installation process, it's possible that other questions may +# be asked. You can preseed those too, of course. To get a list of every +# possible question that could be asked during an install, do an +# installation, and then run these commands: + debconf-get-selections --installer > /target/root/preceed.cfg + debconf-get-selections >> /target/root/preceed.cfg + +#### Advanced options +### Running custom commands during the installation +# d-i preseeding is inherently not secure. Nothing in the installer checks +# for attempts at buffer overflows or other exploits of the values of a +# preconfiguration file like this one. Only use preconfiguration files from +# trusted locations! To drive that home, and because it's generally useful, +# here's a way to run any shell command you'd like inside the installer, +# automatically. + +# This command is run just before the install finishes, but when there is +# still a usable /target directory. You can chroot to /target and use it +# directly, or use the apt-install and in-target commands to easily install +# packages and run commands in the target system. +d-i preseed/late_command string \ +{% if new_user is defined and new_user != 'root' %} + echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ + mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ + echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ +{% endif %} + mkdir -p -m 700 /target/root/.ssh; \ + echo "{{ ssh_public_key }}" > /target/root/.ssh/authorized_keys; \ + in-target chown --recursive root:root /root/.ssh; \ + in-target chmod 0644 /root/.ssh/authorized_keys; \ + in-target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \ + in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \ + echo "{{ autoinstall_complete_msg }}" >/target/dev/ttyS0 diff --git a/linux/deploy_vm/create_unattend_install_iso.yml b/linux/deploy_vm/create_unattend_install_iso.yml index 80b3e6606..5628f7fe3 100644 --- a/linux/deploy_vm/create_unattend_install_iso.yml +++ b/linux/deploy_vm/create_unattend_install_iso.yml @@ -65,6 +65,7 @@ - unattend_install_conf is not match('Debian') - unattend_install_conf is not match('Ubuntu/Desktop/Ubiquity') - unattend_install_conf is not match('FreeBSD') + - unattend_install_conf is not match('Pardus') - name: "Build unattend install config file into OS ISO image" include_tasks: rebuild_unattend_install_iso.yml @@ -74,7 +75,8 @@ unattend_install_conf is match('Photon') or unattend_install_conf is match('Debian') or unattend_install_conf is match('Ubuntu/Desktop/Ubiquity') or - unattend_install_conf is match('FreeBSD') + unattend_install_conf is match('FreeBSD') or + unattend_install_conf is match('Pardus') when: - unattend_install_conf is not match('Ubuntu/Server/') - unattend_install_conf is not match('Ubuntu/Desktop/Subiquity') @@ -143,6 +145,7 @@ - unattend_install_conf is not match('Debian') - unattend_install_conf is not match('Ubuntu/Desktop/Ubiquity') - unattend_install_conf is not match('FreeBSD') + - unattend_install_conf is not match('Pardus') - name: "Replace original install ISO file with unattend install ISO file" ansible.builtin.set_fact: @@ -152,7 +155,8 @@ unattend_install_conf is match('Photon') or unattend_install_conf is match('Debian') or unattend_install_conf is match('Ubuntu/Desktop/Ubiquity') or - unattend_install_conf is match('FreeBSD') + unattend_install_conf is match('FreeBSD') or + unattend_install_conf is match('Pardus') - name: "Copy generated unattend install config file to log folder" ansible.builtin.copy: diff --git a/linux/deploy_vm/deploy_vm_from_iso.yml b/linux/deploy_vm/deploy_vm_from_iso.yml index 1ebfae5d1..ab67ff159 100644 --- a/linux/deploy_vm/deploy_vm_from_iso.yml +++ b/linux/deploy_vm/deploy_vm_from_iso.yml @@ -48,6 +48,11 @@ ansible.builtin.set_fact: unattend_install_conf: "FreeBSD/installerconfig" when: "'freebsd' in guest_id" + + - name: "Set default unattend install conf file for Pardus" + ansible.builtin.set_fact: + unattend_install_conf: "Pardus/preseed.cfg" + when: "'other5xLinux64Guest' in guest_id" when: unattend_install_conf is undefined or not unattend_install_conf - ansible.builtin.debug: diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 4ee6cbb35..4f60962b7 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -339,3 +339,89 @@ - src_file: "{{ new_unattend_install_conf }}" dest_file: "/etc/installerconfig" when: unattend_install_conf is match('FreeBSD') + +- name: "Rebuild ISO for Pardus" + block: + - name: "Extract specific files inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - 'boot/grub/grub.cfg' + - 'isolinux/isolinux.cfg' + - 'isolinux/install_en.cfg' + - 'md5sum.txt' + + - name: "Update timeout for boot menu" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "timeout 0" + replace: "timeout 1" + + - name: "Update timeout for boot menu" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "default .*" + replace: "default installgui" + + - name: "Update boot menu with preseed.cfg for Pardus" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/install_en.cfg" + regexp: '(.*)(append )(.*)' + replace: "\\1\\2 auto=true file=/cdrom/{{ unattend_install_file_name }} \\3" + + - name: "Update default memuentry for grub.cfg" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/grub.cfg" + regexp: "set default=0" + replace: "set default=1\nset timeout=3" + + - name: "Update Pardus grub.cfg for autoinstall" + ansible.builtin.blockinfile: + path: "{{ src_iso_file_dir }}/grub.cfg" + insertafter: "^submenu.*English.*{#" + block: | + set default="autoinstall" + set timeout=5 + + - name: "Update Pardus grub.cfg for autoinstall" + ansible.builtin.blockinfile: + path: "{{ src_iso_file_dir }}/grub.cfg" + insertbefore: "^}#" + block: | + menuentry "Automated installation" --id autoinstall { + set background_color=black + linux /install/gtk/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} vga=788 --- quiet + initrd /install/gtk/initrd.gz + } + + - name: "Update md5sum for Pardus ISO files" + ansible.builtin.shell: "{{ item }}" + with_items: + - "sed -i '#./isolinux/isolinux.cfg#d' md5sum.txt" + - "echo \"`md5sum isolinux.cfg | awk '{print $1}'` ./isolinux/isolinux.cfg\" >>md5sum.txt" + - "sed -i '#./boot/grub/grub.cfg#d' md5sum.txt" + - "echo \"`md5sum grub.cfg | awk '{print $1}'` ./boot/grub/grub.cfg\" >>md5sum.txt" + args: + chdir: "{{ src_iso_file_dir }}" + register: update_initrd_output + + - name: "Print command output for updating initrd" + ansible.builtin.debug: var=update_initrd_output + + - name: "Customize the ISO" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "boot/grub/grub.cfg" + - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" + dest_file: "isolinux/isolinux.cfg" + - src_file: "{{ src_iso_file_dir }}/install_en.cfg" + dest_file: "isolinux/gtk.cfg" + - src_file: "{{ src_iso_file_dir }}/md5sum.txt" + dest_file: "md5sum.txt" + - src_file: "{{ new_unattend_install_conf }}" + dest_file: "{{ unattend_install_file_name }}" + when: unattend_install_conf is match('Pardus') \ No newline at end of file From e906f4862a42b91f027a3c40318fd217ef5fecba Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Sun, 23 Apr 2023 19:53:22 +0800 Subject: [PATCH 02/41] support autoinstall for Pardus Signed-off-by: ZouYuhua --- linux/deploy_vm/rebuild_unattend_install_iso.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 4f60962b7..35edb9f9c 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -419,7 +419,7 @@ - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" dest_file: "isolinux/isolinux.cfg" - src_file: "{{ src_iso_file_dir }}/install_en.cfg" - dest_file: "isolinux/gtk.cfg" + dest_file: "isolinux/install_en.cfg" - src_file: "{{ src_iso_file_dir }}/md5sum.txt" dest_file: "md5sum.txt" - src_file: "{{ new_unattend_install_conf }}" From 1aa68d9cd74e5c28548bf0635d7af6e64cba875f Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Mon, 24 Apr 2023 19:04:15 +0800 Subject: [PATCH 03/41] support autoinstall for freebsd Signed-off-by: ZouYuhua --- linux/deploy_vm/deploy_vm_from_iso.yml | 5 ----- linux/deploy_vm/rebuild_unattend_install_iso.yml | 15 +++++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/linux/deploy_vm/deploy_vm_from_iso.yml b/linux/deploy_vm/deploy_vm_from_iso.yml index ab67ff159..1ebfae5d1 100644 --- a/linux/deploy_vm/deploy_vm_from_iso.yml +++ b/linux/deploy_vm/deploy_vm_from_iso.yml @@ -48,11 +48,6 @@ ansible.builtin.set_fact: unattend_install_conf: "FreeBSD/installerconfig" when: "'freebsd' in guest_id" - - - name: "Set default unattend install conf file for Pardus" - ansible.builtin.set_fact: - unattend_install_conf: "Pardus/preseed.cfg" - when: "'other5xLinux64Guest' in guest_id" when: unattend_install_conf is undefined or not unattend_install_conf - ansible.builtin.debug: diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 35edb9f9c..5313f51d2 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -377,22 +377,21 @@ replace: "set default=1\nset timeout=3" - name: "Update Pardus grub.cfg for autoinstall" - ansible.builtin.blockinfile: + ansible.builtin.lineinfile: path: "{{ src_iso_file_dir }}/grub.cfg" insertafter: "^submenu.*English.*{#" - block: | - set default="autoinstall" - set timeout=5 + line: ' set default="autoinstall"' - name: "Update Pardus grub.cfg for autoinstall" ansible.builtin.blockinfile: path: "{{ src_iso_file_dir }}/grub.cfg" - insertbefore: "^}#" + insertafter: ".*autoinstall.*" block: | + # menuentry for unattended installation menuentry "Automated installation" --id autoinstall { - set background_color=black - linux /install/gtk/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} vga=788 --- quiet - initrd /install/gtk/initrd.gz + set background_color=black + linux /install/gtk/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} video=vesa:ywrap,mtrr vga=788 --- quiet + initrd /install/gtk/initrd.gz } - name: "Update md5sum for Pardus ISO files" From 700602cbc62550d9548233a0867a54fd22cb3528 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 26 Apr 2023 08:50:54 +0800 Subject: [PATCH 04/41] support autoinstall for Pardus Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 65 +++++++------------ autoinstall/README.md | 1 + .../rebuild_unattend_install_iso.yml | 31 +++++++-- 3 files changed, 50 insertions(+), 47 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 565dc887f..f07f00834 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -1,16 +1,16 @@ #_preseed_V1 -#### Contents of the preconfiguration file (for bullseye) +#### Contents of the preconfiguration file (for pardus) + +d-i debconf/language string en_US:en +d-i debian-installer/country string US +d-i debian-installer/fallbacklocale string en_US +d-i debian-installer/language string en_US:en +d-i languagechooser/locale string en + ### Localization # Preseeding only locale sets language, country and locale. d-i debian-installer/locale string en_US -# The values can also be preseeded individually for greater flexibility. -d-i debian-installer/language string en -d-i debian-installer/country string US -#d-i debian-installer/locale string en_GB.UTF-8 -# Optionally specify additional locales to be generated. -d-i localechooser/supported-locales multiselect en_US.UTF-8 - # Keyboard selection. d-i keyboard-configuration/xkb-keymap select us d-i keyboard-configuration/variant select English (US) @@ -44,14 +44,20 @@ d-i netcfg/get_domain string unassigned-domain # Disable that annoying WEP key dialog. d-i netcfg/wireless_wep string -### Mirror settings -#d-i mirror/country string US -#d-i mirror/http/directory string /debian/ -#d-i mirror/http/hostname string deb.debian.org -#d-i mirror/http/mirror select deb.debian.org -#d-i mirror/no-default boolean true -#d-i mirror/protocol select http -#d-i mirror/http/proxy string +### Clock and time zone setup +# Controls whether or not the hardware clock is set to UTC. +d-i clock-setup/utc boolean true + +# You may set this to any valid setting for $TZ; see the contents of +# /usr/share/zoneinfo/ for valid values. +d-i time/zone string US/Eastern + +# Controls whether to use NTP to set the clock during the install +d-i clock-setup/ntp boolean true +# NTP server to use. The default is almost always fine here. +#d-i clock-setup/ntp-server string ntp.example.com +d-i console-setup/ask_detect boolean false +d-i console-setup/layoutcode string us ### Account setup # Root password encrypted using a crypt(3) hash. @@ -69,21 +75,6 @@ d-i passwd/user-password-crypted password {{ vm_password_hash }} d-i passwd/user-default-groups string root wheel {% endif %} -### Clock and time zone setup -# Controls whether or not the hardware clock is set to UTC. -d-i clock-setup/utc boolean true - -# You may set this to any valid setting for $TZ; see the contents of -# /usr/share/zoneinfo/ for valid values. -d-i time/zone string US/Eastern - -# Controls whether to use NTP to set the clock during the install -d-i clock-setup/ntp boolean true -# NTP server to use. The default is almost always fine here. -#d-i clock-setup/ntp-server string ntp.example.com -d-i console-setup/ask_detect boolean false -d-i console-setup/layoutcode string us - ### Partitioning ## Partitioning example # Specify a disk to partition. @@ -160,7 +151,7 @@ d-i apt-setup/enable-source-repositories boolean false ### Package selection #tasksel tasksel/first multiselect standard, web-server, kde-desktop tasksel tasksel/first multiselect standard, desktop -tasksel tasksel/desktop multiselect gnome +tasksel tasksel/desktop multiselect xfce # Individual additional packages to install # There is no open-vm-tools-desktop and cloud-init in CDROM @@ -196,15 +187,7 @@ d-i finish-install/reboot_in_progress note # This will prevent the installer from ejecting the CD during the reboot, # which is useful in some situations. #d-i cdrom-detect/eject boolean false - -### Preseeding other packages -# Depending on what software you choose to install, or if things go wrong -# during the installation process, it's possible that other questions may -# be asked. You can preseed those too, of course. To get a list of every -# possible question that could be asked during an install, do an -# installation, and then run these commands: - debconf-get-selections --installer > /target/root/preceed.cfg - debconf-get-selections >> /target/root/preceed.cfg +#d-i cdrom-detect/eject boolean true #### Advanced options ### Running custom commands during the installation diff --git a/autoinstall/README.md b/autoinstall/README.md index d140c1f3d..8c7457f1d 100644 --- a/autoinstall/README.md +++ b/autoinstall/README.md @@ -18,6 +18,7 @@ 17. For UnionTech OS Server 20 1050e unattend auto-install, please use file UOS/Server/20/1050e/ks.cfg. 18. For Fedora Server 36 or later unattend auto-install, please use file Fedora/36/Server/ks.cfg. 19. For FreeBSD 13 or later unattend auto-install, please use file FreeBSD/installerconfig. +20. For Pardus 21.x or later unattend auto-install, please use file Pardus/preseed.cfg. # Notes ## For Windows diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 5313f51d2..260f29a30 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -350,25 +350,38 @@ - 'boot/grub/grub.cfg' - 'isolinux/isolinux.cfg' - 'isolinux/install_en.cfg' + - 'isolinux/install.cfg' - 'md5sum.txt' - - name: "Update timeout for boot menu" + - name: "Update timeout of file isolinux.cfg" ansible.builtin.replace: path: "{{ src_iso_file_dir }}/isolinux.cfg" regexp: "timeout 0" replace: "timeout 1" - - name: "Update timeout for boot menu" + - name: "Update file isolinux.cfg" ansible.builtin.replace: path: "{{ src_iso_file_dir }}/isolinux.cfg" regexp: "default .*" replace: "default installgui" - - name: "Update boot menu with preseed.cfg for Pardus" + - name: "Update default boot label" + ansible.builtin.lineinfile: + path: "{{ src_iso_file_dir }}/{{ item }}" + insertbefore: "^label install$" + line: "default installgui" + with_items: + - "install_en.cfg" + - "install.cfg" + + - name: "Update boot parameters with preseed.cfg" ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/install_en.cfg" + path: "{{ src_iso_file_dir }}/{{ item }}" regexp: '(.*)(append )(.*)' replace: "\\1\\2 auto=true file=/cdrom/{{ unattend_install_file_name }} \\3" + with_items: + - "install_en.cfg" + - "install.cfg" - name: "Update default memuentry for grub.cfg" ansible.builtin.replace: @@ -376,13 +389,13 @@ regexp: "set default=0" replace: "set default=1\nset timeout=3" - - name: "Update Pardus grub.cfg for autoinstall" + - name: "Update default boot entry for autoinstall" ansible.builtin.lineinfile: path: "{{ src_iso_file_dir }}/grub.cfg" insertafter: "^submenu.*English.*{#" line: ' set default="autoinstall"' - - name: "Update Pardus grub.cfg for autoinstall" + - name: "Update boot parameters for autoinstall" ansible.builtin.blockinfile: path: "{{ src_iso_file_dir }}/grub.cfg" insertafter: ".*autoinstall.*" @@ -401,6 +414,10 @@ - "echo \"`md5sum isolinux.cfg | awk '{print $1}'` ./isolinux/isolinux.cfg\" >>md5sum.txt" - "sed -i '#./boot/grub/grub.cfg#d' md5sum.txt" - "echo \"`md5sum grub.cfg | awk '{print $1}'` ./boot/grub/grub.cfg\" >>md5sum.txt" + - "sed -i '#./isolinux/install_en.cfg#d' md5sum.txt" + - "echo \"`md5sum install_en.cfg | awk '{print $1}'` ./isolinux/install_en.cfg\" >>md5sum.txt" + - "sed -i '#./isolinux/install.cfg#d' md5sum.txt" + - "echo \"`md5sum install.cfg | awk '{print $1}'` ./isolinux/install.cfg\" >>md5sum.txt" args: chdir: "{{ src_iso_file_dir }}" register: update_initrd_output @@ -419,6 +436,8 @@ dest_file: "isolinux/isolinux.cfg" - src_file: "{{ src_iso_file_dir }}/install_en.cfg" dest_file: "isolinux/install_en.cfg" + - src_file: "{{ src_iso_file_dir }}/install.cfg" + dest_file: "isolinux/install.cfg" - src_file: "{{ src_iso_file_dir }}/md5sum.txt" dest_file: "md5sum.txt" - src_file: "{{ new_unattend_install_conf }}" From d7be7a31300b39cf82a52e8f9ec0b17a7d639c62 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 26 Apr 2023 15:11:01 +0800 Subject: [PATCH 05/41] modify preseed.cfg for pardus Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index f07f00834..dddba95d5 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -143,6 +143,8 @@ d-i apt-setup/cdrom/set-first boolean false d-i apt-setup/cdrom/set-next boolean false d-i apt-setup/cdrom/set-failed boolean false d-i apt-setup/disable-cdrom-entries boolean true +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true # Don't add any security and updates repo to avoid an upgrade during installation d-i apt-setup/services-select multiselect @@ -154,8 +156,8 @@ tasksel tasksel/first multiselect standard, desktop tasksel tasksel/desktop multiselect xfce # Individual additional packages to install -# There is no open-vm-tools-desktop and cloud-init in CDROM -d-i pkgsel/include string build-essential vim locales open-vm-tools openssh-server sg3-utils +# There is no open-vm-tools-desktop openssh-server and cloud-init in CDROM +d-i pkgsel/include string build-essential locales open-vm-tools openssh-server sg3-utils # Policy for applying updates. May be "none" (no automatic updates), # "unattended-upgrades" (install security updates automatically), or @@ -189,6 +191,15 @@ d-i finish-install/reboot_in_progress note #d-i cdrom-detect/eject boolean false #d-i cdrom-detect/eject boolean true +### Preseeding other packages +# Depending on what software you choose to install, or if things go wrong +# during the installation process, it's possible that other questions may +# be asked. You can preseed those too, of course. To get a list of every +# possible question that could be asked during an install, do an +# installation, and then run these commands: + debconf-get-selections --installer > /target/root/preceed.cfg + debconf-get-selections >> /target/root/preceed.cfg + #### Advanced options ### Running custom commands during the installation # d-i preseeding is inherently not secure. Nothing in the installer checks From 28361baf5985562871bb4ce00cc236458fed9fa8 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 26 Apr 2023 15:37:12 +0800 Subject: [PATCH 06/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index dddba95d5..7961ec5eb 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -138,13 +138,13 @@ d-i partman/confirm_nooverwrite boolean true #d-i partman/mount_style select uuid ### Apt setup -d-i apt-setup/use_mirror boolean false -d-i apt-setup/cdrom/set-first boolean false -d-i apt-setup/cdrom/set-next boolean false -d-i apt-setup/cdrom/set-failed boolean false -d-i apt-setup/disable-cdrom-entries boolean true -d-i apt-setup/non-free boolean true -d-i apt-setup/contrib boolean true +# d-i apt-setup/use_mirror boolean false +# d-i apt-setup/cdrom/set-first boolean false +# d-i apt-setup/cdrom/set-next boolean false +# d-i apt-setup/cdrom/set-failed boolean false +# d-i apt-setup/disable-cdrom-entries boolean true +# d-i apt-setup/non-free boolean true +# d-i apt-setup/contrib boolean true # Don't add any security and updates repo to avoid an upgrade during installation d-i apt-setup/services-select multiselect From cf72ea7bc9fc715e1361538e3bb5758f610f87a8 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 27 Apr 2023 14:03:17 +0800 Subject: [PATCH 07/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 7961ec5eb..873cab717 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -61,6 +61,7 @@ d-i console-setup/layoutcode string us ### Account setup # Root password encrypted using a crypt(3) hash. +d-i passwd/root-login boolean true d-i passwd/root-password-crypted password {{ vm_password_hash }} {% if new_user is defined and new_user != 'root' %} @@ -138,17 +139,23 @@ d-i partman/confirm_nooverwrite boolean true #d-i partman/mount_style select uuid ### Apt setup -# d-i apt-setup/use_mirror boolean false -# d-i apt-setup/cdrom/set-first boolean false -# d-i apt-setup/cdrom/set-next boolean false -# d-i apt-setup/cdrom/set-failed boolean false -# d-i apt-setup/disable-cdrom-entries boolean true -# d-i apt-setup/non-free boolean true -# d-i apt-setup/contrib boolean true +d-i apt-setup/use_mirror boolean false +d-i apt-setup/cdrom/set-first boolean false +d-i apt-setup/cdrom/set-next boolean false +d-i apt-setup/cdrom/set-failed boolean false +d-i apt-setup/disable-cdrom-entries boolean true +d-i apt-setup/enable-source-repositories boolean true +# You can choose to install non-free and contrib software. +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true + +d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free +d-i apt-setup/local0/source boolean false +d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free +d-i apt-setup/local1/source boolean false # Don't add any security and updates repo to avoid an upgrade during installation d-i apt-setup/services-select multiselect -d-i apt-setup/enable-source-repositories boolean false ### Package selection #tasksel tasksel/first multiselect standard, web-server, kde-desktop @@ -157,7 +164,7 @@ tasksel tasksel/desktop multiselect xfce # Individual additional packages to install # There is no open-vm-tools-desktop openssh-server and cloud-init in CDROM -d-i pkgsel/include string build-essential locales open-vm-tools openssh-server sg3-utils +d-i pkgsel/include string build-essential open-vm-tools openssh-server sg3-utils vim # Policy for applying updates. May be "none" (no automatic updates), # "unattended-upgrades" (install security updates automatically), or @@ -214,6 +221,8 @@ d-i finish-install/reboot_in_progress note # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string \ + in-target apt-get update -y: \ + in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ From bc315183d41e9f937a5f7e0e3dbc850dc39750af Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 10:33:37 +0800 Subject: [PATCH 08/41] debug the output to install packages Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 873cab717..7a190f157 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -221,8 +221,9 @@ d-i finish-install/reboot_in_progress note # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string \ - in-target apt-get update -y: \ - in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim; \ + cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ + in-target apt-get update -y >/dev/ttyS0; \ + in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim >/dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ From dd1399d85fd3de0dd953f41923a2bf6f000a5884 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 12:18:39 +0800 Subject: [PATCH 09/41] debug the output to install packages Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 7a190f157..04d4670e0 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -222,8 +222,8 @@ d-i finish-install/reboot_in_progress note # packages and run commands in the target system. d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ - in-target apt-get update -y >/dev/ttyS0; \ - in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim >/dev/ttyS0; \ + in-target apt-get update -y > /target/dev/ttyS0; \ + in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /target/dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ From dec4bdb289a91926115e4b1c1327284c4c78baa5 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 14:51:18 +0800 Subject: [PATCH 10/41] debug the output to install packages Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 04d4670e0..adf41edea 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -222,17 +222,17 @@ d-i finish-install/reboot_in_progress note # packages and run commands in the target system. d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ - in-target apt-get update -y > /target/dev/ttyS0; \ - in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /target/dev/ttyS0; \ + in-target apt-get update -y > /dev/ttyS0; \ + in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ {% endif %} - mkdir -p -m 700 /target/root/.ssh; \ - echo "{{ ssh_public_key }}" > /target/root/.ssh/authorized_keys; \ + in-target mkdir -p -m 700 /root/.ssh; \ + in-target echo "{{ ssh_public_key }}" > /root/.ssh/authorized_keys; \ in-target chown --recursive root:root /root/.ssh; \ in-target chmod 0644 /root/.ssh/authorized_keys; \ in-target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \ in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \ - echo "{{ autoinstall_complete_msg }}" >/target/dev/ttyS0 + in-target echo "{{ autoinstall_complete_msg }}" > /dev/ttyS0 From 28244aec106513b90d1de85a584f786657d5cb0a Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 16:16:43 +0800 Subject: [PATCH 11/41] replate in-target with chroot /target because it's invalid with in-target Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index adf41edea..312c0d0e5 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -229,10 +229,10 @@ d-i preseed/late_command string \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ {% endif %} - in-target mkdir -p -m 700 /root/.ssh; \ - in-target echo "{{ ssh_public_key }}" > /root/.ssh/authorized_keys; \ - in-target chown --recursive root:root /root/.ssh; \ - in-target chmod 0644 /root/.ssh/authorized_keys; \ + chroot /target mkdir -p -m 700 /root/.ssh; \ + chroot /target echo "{{ ssh_public_key }}" > /root/.ssh/authorized_keys; \ + chroot /target chown --recursive root:root /root/.ssh; \ + chroot /target chmod 0644 /root/.ssh/authorized_keys; \ in-target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \ in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \ - in-target echo "{{ autoinstall_complete_msg }}" > /dev/ttyS0 + chroot /target echo "{{ autoinstall_complete_msg }}" > /dev/ttyS0 From 8f73d93d6f0b5d94510433b1b2e4929b8b22b27e Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 17:12:21 +0800 Subject: [PATCH 12/41] replate in-target with chroot /target because it's invalid with in-target Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 312c0d0e5..e6865b8a6 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -221,18 +221,18 @@ d-i finish-install/reboot_in_progress note # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string \ - cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ - in-target apt-get update -y > /dev/ttyS0; \ - in-target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ +cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ +chroot /target apt-get update -y > /dev/ttyS0; \ +chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} - echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ - mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ - echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ +echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ +mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ +echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ {% endif %} - chroot /target mkdir -p -m 700 /root/.ssh; \ - chroot /target echo "{{ ssh_public_key }}" > /root/.ssh/authorized_keys; \ - chroot /target chown --recursive root:root /root/.ssh; \ - chroot /target chmod 0644 /root/.ssh/authorized_keys; \ - in-target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \ - in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \ - chroot /target echo "{{ autoinstall_complete_msg }}" > /dev/ttyS0 +chroot /target mkdir -p -m 700 /root/.ssh; \ +chroot /target echo "{{ ssh_public_key }}" > /root/.ssh/authorized_keys; \ +chroot /target chown --recursive root:root /root/.ssh; \ +chroot /target chmod 0644 /root/.ssh/authorized_keys; \ +chroot /target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \ +chroot /target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \ +chroot /target echo "{{ autoinstall_complete_msg }}" > /dev/ttyS0 From 82d0d47c18a87170b5239f26d73a54553079df11 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 18:43:50 +0800 Subject: [PATCH 13/41] check network Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index e6865b8a6..7ae1a9fc6 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -222,6 +222,8 @@ d-i finish-install/reboot_in_progress note # packages and run commands in the target system. d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ +chroot /target ip addr show > /target/dev/ttyS0; \ +chroot /target ping -c 5 www.baidu.com > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} From 337ce442c30b6ce4b5ece8aeac354da536d0a9e2 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 18:47:31 +0800 Subject: [PATCH 14/41] check network Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 7ae1a9fc6..e0d33f478 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -224,6 +224,9 @@ d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ chroot /target ip addr show > /target/dev/ttyS0; \ chroot /target ping -c 5 www.baidu.com > /target/dev/ttyS0; \ +chroot /target systemctl systemd-networkd.service; \ +chroot /target ip addr show > /target/dev/ttyS0; \ +chroot /target ping -c 5 www.baidu.com > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} From a9dab93c079f62db88f0afbdecbae5c4ca0bf2be Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 20:56:50 +0800 Subject: [PATCH 15/41] delete network configuration Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 43 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index e0d33f478..047068339 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -18,31 +18,32 @@ d-i keyboard-configuration/variant select English (US) ### Network configuration # netcfg will choose an interface that has link if possible. This makes it # skip displaying a list if there is more than one interface. -d-i netcfg/choose_interface select auto -d-i netcfg/use_dhcp string true +#d-i netcfg/choose_interface select auto +#d-i netcfg/use_dhcp string true # To set a different link detection timeout (default is 3 seconds). # Values are interpreted as seconds. -d-i netcfg/link_wait_timeout string 10 +#d-i netcfg/link_wait_timeout string 10 # If you have a slow dhcp server and the installer times out waiting for # it, this might be useful. -d-i netcfg/dhcp_timeout string 60 +#d-i netcfg/dhcp_timeout string 60 #d-i netcfg/dhcpv6_timeout string 60 # If you want the preconfiguration file to work on systems both with and # without a dhcp server, uncomment these lines and the static network # configuration below. -d-i netcfg/dhcp_failed note +#d-i netcfg/dhcp_failed note # Any hostname and domain names assigned from dhcp take precedence over # values set here. However, setting the values still prevents the questions # from being shown, even if values come from dhcp. -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain +#d-i netcfg/get_hostname string unassigned-hostname +#d-i netcfg/get_domain string unassigned-domain -# Disable that annoying WEP key dialog. -d-i netcfg/wireless_wep string +# Change default hostname +d-i netcfg/get_hostname string pardus +d-i netcfg/get_hostname seen false ### Clock and time zone setup # Controls whether or not the hardware clock is set to UTC. @@ -138,6 +139,17 @@ d-i partman/confirm_nooverwrite boolean true # falling back to UUIDs. #d-i partman/mount_style select uuid +d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free +d-i apt-setup/local0/source boolean false +d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free +d-i apt-setup/local1/source boolean false + +# Don't add any security and updates repo to avoid an upgrade during installation +# We might need these later, think about the following lines. +d-i apt-setup/services-select multiselect +#d-i apt-setup/security_host string depo.pardus.org.tr +#d-i apt-setup/security_path string /guvenlik + ### Apt setup d-i apt-setup/use_mirror boolean false d-i apt-setup/cdrom/set-first boolean false @@ -149,13 +161,8 @@ d-i apt-setup/enable-source-repositories boolean true d-i apt-setup/non-free boolean true d-i apt-setup/contrib boolean true -d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free -d-i apt-setup/local0/source boolean false -d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free -d-i apt-setup/local1/source boolean false - -# Don't add any security and updates repo to avoid an upgrade during installation -d-i apt-setup/services-select multiselect +# Disable upgrading while installation +d-i pkgsel/upgrade select none ### Package selection #tasksel tasksel/first multiselect standard, web-server, kde-desktop @@ -223,10 +230,6 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ chroot /target ip addr show > /target/dev/ttyS0; \ -chroot /target ping -c 5 www.baidu.com > /target/dev/ttyS0; \ -chroot /target systemctl systemd-networkd.service; \ -chroot /target ip addr show > /target/dev/ttyS0; \ -chroot /target ping -c 5 www.baidu.com > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} From 9531f1cd0a2407b8e36322abb2bd79f0b14dda1a Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 4 May 2023 22:47:55 +0800 Subject: [PATCH 16/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 047068339..160e46d1e 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -38,12 +38,8 @@ d-i keyboard-configuration/variant select English (US) # Any hostname and domain names assigned from dhcp take precedence over # values set here. However, setting the values still prevents the questions # from being shown, even if values come from dhcp. -#d-i netcfg/get_hostname string unassigned-hostname -#d-i netcfg/get_domain string unassigned-domain - -# Change default hostname d-i netcfg/get_hostname string pardus -d-i netcfg/get_hostname seen false +d-i netcfg/get_domain string unassigned-domain ### Clock and time zone setup # Controls whether or not the hardware clock is set to UTC. From 9916d411503638c8280cdbfcf3b6318e71a371ae Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Fri, 5 May 2023 07:45:53 +0800 Subject: [PATCH 17/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 36 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 160e46d1e..4246fe48b 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -16,24 +16,29 @@ d-i keyboard-configuration/xkb-keymap select us d-i keyboard-configuration/variant select English (US) ### Network configuration +# Disable network configuration entirely. This is useful for cdrom +# installations on non-networked devices where the network questions, +# warning and long timeouts are a nuisance. +d-i netcfg/enable boolean true + # netcfg will choose an interface that has link if possible. This makes it # skip displaying a list if there is more than one interface. -#d-i netcfg/choose_interface select auto -#d-i netcfg/use_dhcp string true +d-i netcfg/choose_interface select auto +d-i netcfg/use_dhcp string true # To set a different link detection timeout (default is 3 seconds). # Values are interpreted as seconds. -#d-i netcfg/link_wait_timeout string 10 +d-i netcfg/link_wait_timeout string 10 # If you have a slow dhcp server and the installer times out waiting for # it, this might be useful. -#d-i netcfg/dhcp_timeout string 60 -#d-i netcfg/dhcpv6_timeout string 60 +d-i netcfg/dhcp_timeout string 60 +d-i netcfg/dhcpv6_timeout string 60 # If you want the preconfiguration file to work on systems both with and # without a dhcp server, uncomment these lines and the static network # configuration below. -#d-i netcfg/dhcp_failed note +d-i netcfg/dhcp_failed note # Any hostname and domain names assigned from dhcp take precedence over # values set here. However, setting the values still prevents the questions @@ -225,7 +230,10 @@ d-i finish-install/reboot_in_progress note # packages and run commands in the target system. d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ -chroot /target ip addr show > /target/dev/ttyS0; \ +ip addr show > /target/dev/ttyS0; \ +chroot /target /sbin/ifconfig $(ifconfig | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ +sleep 5; \ +ip addr show > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} @@ -233,10 +241,10 @@ echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ {% endif %} -chroot /target mkdir -p -m 700 /root/.ssh; \ -chroot /target echo "{{ ssh_public_key }}" > /root/.ssh/authorized_keys; \ -chroot /target chown --recursive root:root /root/.ssh; \ -chroot /target chmod 0644 /root/.ssh/authorized_keys; \ -chroot /target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \ -chroot /target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \ -chroot /target echo "{{ autoinstall_complete_msg }}" > /dev/ttyS0 +mkdir -p -m 700 /target/root/.ssh; \ +echo "{{ ssh_public_key }}" > /target/root/.ssh/authorized_keys; \ +chown --recursive root:root /target/root/.ssh; \ +chmod 0644 /target/root/.ssh/authorized_keys; \ +sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config; \ +sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /target/etc/ssh/sshd_config; \ +echo "{{ autoinstall_complete_msg }}" > /target/dev/ttyS0 From aef3537dd88a3fe0223a9737ab5ef5a7b0939331 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Fri, 5 May 2023 08:04:05 +0800 Subject: [PATCH 18/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 4246fe48b..8655c15a6 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -231,7 +231,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ ip addr show > /target/dev/ttyS0; \ -chroot /target /sbin/ifconfig $(ifconfig | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ +chroot /target /sbin/ifconfig $(/sbin/ifconfig -a | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ sleep 5; \ ip addr show > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ From 740ea032c48892a2aaa45a9f11c87b07cd718fc3 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Fri, 5 May 2023 09:24:29 +0800 Subject: [PATCH 19/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 35 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 8655c15a6..36a667e99 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -134,22 +134,24 @@ d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true -## Controlling how partitions are mounted -# The default is to mount by UUID, but you can also choose "traditional" to -# use traditional device names, or "label" to try filesystem labels before -# falling back to UUIDs. -#d-i partman/mount_style select uuid - -d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free -d-i apt-setup/local0/source boolean false -d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free -d-i apt-setup/local1/source boolean false - +# Add offical repo +#d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free +#d-i apt-setup/local0/source boolean false +#d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free +#d-i apt-setup/local1/source boolean false + +# Default repository information (don't include codename data, d-i figures it +# out from what's available in the ISO) +d-i mirror/country string manually +d-i mirror/http/hostname string depo.pardus.org.tr +d-i mirror/http/hostname seen false +d-i mirror/http/directory string /pardus +d-i mirror/http/proxy string # Don't add any security and updates repo to avoid an upgrade during installation # We might need these later, think about the following lines. d-i apt-setup/services-select multiselect -#d-i apt-setup/security_host string depo.pardus.org.tr -#d-i apt-setup/security_path string /guvenlik +d-i apt-setup/security_host string depo.pardus.org.tr +d-i apt-setup/security_path string /guvenlik ### Apt setup d-i apt-setup/use_mirror boolean false @@ -229,11 +231,16 @@ d-i finish-install/reboot_in_progress note # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string \ -cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ +echo "Check network ..." > /target/dev/ttyS0 ip addr show > /target/dev/ttyS0; \ +echo "Up network ..." > /target/dev/ttyS0 chroot /target /sbin/ifconfig $(/sbin/ifconfig -a | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ sleep 5; \ +echo "Check network ..." > /target/dev/ttyS0 ip addr show > /target/dev/ttyS0; \ +echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0 +cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ +echo "Install packages ..." > /target/dev/ttyS0 chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} From 41b3e6ed6537f7a5575304e7593d17cb12b827e0 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Fri, 5 May 2023 11:29:55 +0800 Subject: [PATCH 20/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 84 +++++++++++++++------------------- 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 36a667e99..26f72f24a 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -135,23 +135,23 @@ d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true # Add offical repo -#d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free -#d-i apt-setup/local0/source boolean false -#d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free -#d-i apt-setup/local1/source boolean false +d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free +d-i apt-setup/local0/source boolean false +d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free +d-i apt-setup/local1/source boolean false # Default repository information (don't include codename data, d-i figures it # out from what's available in the ISO) -d-i mirror/country string manually -d-i mirror/http/hostname string depo.pardus.org.tr -d-i mirror/http/hostname seen false -d-i mirror/http/directory string /pardus -d-i mirror/http/proxy string +#d-i mirror/country string manually +#d-i mirror/http/hostname string depo.pardus.org.tr +#d-i mirror/http/hostname seen false +#d-i mirror/http/directory string /pardus +#d-i mirror/http/proxy string # Don't add any security and updates repo to avoid an upgrade during installation # We might need these later, think about the following lines. -d-i apt-setup/services-select multiselect -d-i apt-setup/security_host string depo.pardus.org.tr -d-i apt-setup/security_path string /guvenlik +#d-i apt-setup/services-select multiselect +#d-i apt-setup/security_host string depo.pardus.org.tr +#d-i apt-setup/security_path string /guvenlik ### Apt setup d-i apt-setup/use_mirror boolean false @@ -174,7 +174,7 @@ tasksel tasksel/desktop multiselect xfce # Individual additional packages to install # There is no open-vm-tools-desktop openssh-server and cloud-init in CDROM -d-i pkgsel/include string build-essential open-vm-tools openssh-server sg3-utils vim +#d-i pkgsel/include string build-essential open-vm-tools openssh-server sg3-utils vim # Policy for applying updates. May be "none" (no automatic updates), # "unattended-upgrades" (install security updates automatically), or @@ -205,7 +205,6 @@ d-i finish-install/reboot_in_progress note # This will prevent the installer from ejecting the CD during the reboot, # which is useful in some situations. -#d-i cdrom-detect/eject boolean false #d-i cdrom-detect/eject boolean true ### Preseeding other packages @@ -217,41 +216,32 @@ d-i finish-install/reboot_in_progress note debconf-get-selections --installer > /target/root/preceed.cfg debconf-get-selections >> /target/root/preceed.cfg -#### Advanced options -### Running custom commands during the installation -# d-i preseeding is inherently not secure. Nothing in the installer checks -# for attempts at buffer overflows or other exploits of the values of a -# preconfiguration file like this one. Only use preconfiguration files from -# trusted locations! To drive that home, and because it's generally useful, -# here's a way to run any shell command you'd like inside the installer, -# automatically. - # This command is run just before the install finishes, but when there is # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string \ -echo "Check network ..." > /target/dev/ttyS0 -ip addr show > /target/dev/ttyS0; \ -echo "Up network ..." > /target/dev/ttyS0 -chroot /target /sbin/ifconfig $(/sbin/ifconfig -a | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ -sleep 5; \ -echo "Check network ..." > /target/dev/ttyS0 -ip addr show > /target/dev/ttyS0; \ -echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0 -cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ -echo "Install packages ..." > /target/dev/ttyS0 -chroot /target apt-get update -y > /dev/ttyS0; \ -chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ -{% if new_user is defined and new_user != 'root' %} -echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ -mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ -echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ -{% endif %} -mkdir -p -m 700 /target/root/.ssh; \ -echo "{{ ssh_public_key }}" > /target/root/.ssh/authorized_keys; \ -chown --recursive root:root /target/root/.ssh; \ -chmod 0644 /target/root/.ssh/authorized_keys; \ -sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config; \ -sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /target/etc/ssh/sshd_config; \ -echo "{{ autoinstall_complete_msg }}" > /target/dev/ttyS0 + echo "Check network ..." > /target/dev/ttyS0 + ip addr show > /target/dev/ttyS0; \ + echo "Up network ..." > /target/dev/ttyS0 + chroot /target /sbin/ifconfig $(/sbin/ifconfig -a | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ + sleep 5; \ + echo "Check network after linkup nic ..." > /target/dev/ttyS0 + ip addr show > /target/dev/ttyS0; \ + echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0 + cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ + echo "Install packages ..." > /target/dev/ttyS0 + chroot /target apt-get update -y > /dev/ttyS0; \ + chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ + {% if new_user is defined and new_user != 'root' %} + echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ + mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ + echo "{{ ssh_public_key }}" > /target/home/{{ new_user }}/.ssh/authorized_keys; \ + {% endif %} + mkdir -p -m 700 /target/root/.ssh; \ + echo "{{ ssh_public_key }}" > /target/root/.ssh/authorized_keys; \ + chown --recursive root:root /target/root/.ssh; \ + chmod 0644 /target/root/.ssh/authorized_keys; \ + sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config; \ + sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /target/etc/ssh/sshd_config; \ + echo "{{ autoinstall_complete_msg }}" > /target/dev/ttyS0 From 35224b81721fa6b005e375ce0ce340367c7ca14e Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Fri, 5 May 2023 14:57:07 +0800 Subject: [PATCH 21/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 26f72f24a..9a20bf474 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -221,16 +221,16 @@ d-i finish-install/reboot_in_progress note # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string \ - echo "Check network ..." > /target/dev/ttyS0 + echo "Check network ..." > /target/dev/ttyS0; \ ip addr show > /target/dev/ttyS0; \ - echo "Up network ..." > /target/dev/ttyS0 + echo "Up network ..." > /target/dev/ttyS0; \ chroot /target /sbin/ifconfig $(/sbin/ifconfig -a | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ sleep 5; \ - echo "Check network after linkup nic ..." > /target/dev/ttyS0 + echo "Check network after linkup nic ..." > /target/dev/ttyS0; \ ip addr show > /target/dev/ttyS0; \ - echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0 + echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0; \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ - echo "Install packages ..." > /target/dev/ttyS0 + echo "Install packages ..." > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} From 460fa851cc0b7be789b4bc237e9a23c496333ec5 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Mon, 8 May 2023 10:10:20 +0800 Subject: [PATCH 22/41] fix issue: stuck to install openssh-server for pardus 21.2 server Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 9a20bf474..8c27c0a58 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -232,7 +232,8 @@ d-i preseed/late_command string \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ echo "Install packages ..." > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ - chroot /target apt-get install -y --force-yes build-essential open-vm-tools openssh-server sg3-utils vim > /dev/ttyS0; \ + chroot /target apt-get install -y --no-upgrade openssh-server; \ + chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ From 94f2194457b0abf5d598ea128917b1c7f48acc80 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Mon, 8 May 2023 20:23:05 +0800 Subject: [PATCH 23/41] change the codename in file preseed.cfg to support later OS distributions Signed-off-by: ZouYuhua --- .../rebuild_unattend_install_iso.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 260f29a30..2610688b0 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -424,6 +424,41 @@ - name: "Print command output for updating initrd" ansible.builtin.debug: var=update_initrd_output + + - name: "Get file to get code name" + ansible.builtin.shell: "cat {{ src_iso_file_dir }}/md5sum.txt | grep '\.\/dists\/[a-zA-Z]+\/Release$' | cut -d. -f 2" + register: release_file_path + + - name: "Print release file path" + ansible.builtin.debug: var=release_file_path + + - name: "Extract specific release file inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - "{{ release_file_path.stdout.split('/', 1)[-1] }}" + + - name: "Get codename of the ISO distribution" + ansible.builtin.shell: "cat {{ src_iso_file_dir }}/Release | grep Codename | cut -d: -f 2" + register: codename_output + + - name: "Set facts of the codename" + ansible.builtin.set_fact: + os_codename: "{{ codename_output.stdout.split() }}" + + - name: "Print codename" + ansible.builtin.debug: var=os_codename + + - name: "Replace the codename in file preseed.cfg" + ansible.builtin.replace: + path: "{{ new_unattend_install_conf }}" + regexp: "yirmibir" + replace: "{{ os_codename }}" + + - name: "Print the content of unattend install config file after replace codename" + ansible.builtin.debug: + msg: "{{ lookup('file', new_unattend_install_conf) | split('\n') }}" - name: "Customize the ISO" community.general.iso_customize: From fed6cfc79145dc4f5ba73eb19cee6aa918e2a810 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Mon, 8 May 2023 20:58:32 +0800 Subject: [PATCH 24/41] change the codename in file preseed.cfg to support later OS distributions Signed-off-by: ZouYuhua --- linux/deploy_vm/rebuild_unattend_install_iso.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 2610688b0..fe7bef00c 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -426,7 +426,7 @@ ansible.builtin.debug: var=update_initrd_output - name: "Get file to get code name" - ansible.builtin.shell: "cat {{ src_iso_file_dir }}/md5sum.txt | grep '\.\/dists\/[a-zA-Z]+\/Release$' | cut -d. -f 2" + ansible.builtin.shell: "cat {{ src_iso_file_dir }}/md5sum.txt | grep -E 'dists\\/[a-zA-Z]+\\/Release$' | cut -d. -f 2" register: release_file_path - name: "Print release file path" From 5ab4d3963b331c5fec6ae0234275b186bb297656 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Mon, 8 May 2023 21:52:58 +0800 Subject: [PATCH 25/41] change the codename in file preseed.cfg to support later OS distributions Signed-off-by: ZouYuhua --- linux/deploy_vm/rebuild_unattend_install_iso.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index fe7bef00c..3238090fb 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -445,7 +445,7 @@ - name: "Set facts of the codename" ansible.builtin.set_fact: - os_codename: "{{ codename_output.stdout.split() }}" + os_codename: "{{ codename_output.stdout.strip() }}" - name: "Print codename" ansible.builtin.debug: var=os_codename From 19def4996a28d7b9a24a0ac998f9203e904f6d54 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Tue, 9 May 2023 14:51:07 +0800 Subject: [PATCH 26/41] install package open-vm-tools-desktop if have desktop environment Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 8c27c0a58..242084920 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -234,6 +234,8 @@ d-i preseed/late_command string \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --no-upgrade openssh-server; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ + echo "Install packages open-vm-tools-desktop if have desktop environment ..." > /target/dev/ttyS0; \ + if [ -f "/target/usr/bin/Xorg" ]; then chroot /target apt-get install -y open-vm-tools-desktop > /target/dev/ttyS0; fi; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ From 9d9afb2995a7bea7c05178a9ce1f3df8f77aa8b4 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Tue, 9 May 2023 15:08:45 +0800 Subject: [PATCH 27/41] optimize preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 242084920..67b4487ed 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -223,18 +223,18 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ echo "Check network ..." > /target/dev/ttyS0; \ ip addr show > /target/dev/ttyS0; \ - echo "Up network ..." > /target/dev/ttyS0; \ + echo "Linkup network ..." > /target/dev/ttyS0; \ chroot /target /sbin/ifconfig $(/sbin/ifconfig -a | grep '^[a-z]' | cut -d: -f1 | head -n 1) up; \ sleep 5; \ - echo "Check network after linkup nic ..." > /target/dev/ttyS0; \ + echo "Check network after linkup ..." > /target/dev/ttyS0; \ ip addr show > /target/dev/ttyS0; \ echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0; \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ echo "Install packages ..." > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ - chroot /target apt-get install -y --no-upgrade openssh-server; \ + chroot /target apt-get install -y --no-upgrade openssh-server > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ - echo "Install packages open-vm-tools-desktop if have desktop environment ..." > /target/dev/ttyS0; \ + echo "Install package open-vm-tools-desktop if has desktop environment ..." > /target/dev/ttyS0; \ if [ -f "/target/usr/bin/Xorg" ]; then chroot /target apt-get install -y open-vm-tools-desktop > /target/dev/ttyS0; fi; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ From a65d671eb809a898393d2f598b4fd3edeb07faee Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 10 May 2023 13:40:29 +0800 Subject: [PATCH 28/41] change code as codereview Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 5 ----- autoinstall/README.md | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 67b4487ed..06df69702 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -16,7 +16,6 @@ d-i keyboard-configuration/xkb-keymap select us d-i keyboard-configuration/variant select English (US) ### Network configuration -# Disable network configuration entirely. This is useful for cdrom # installations on non-networked devices where the network questions, # warning and long timeouts are a nuisance. d-i netcfg/enable boolean true @@ -33,7 +32,6 @@ d-i netcfg/link_wait_timeout string 10 # If you have a slow dhcp server and the installer times out waiting for # it, this might be useful. d-i netcfg/dhcp_timeout string 60 -d-i netcfg/dhcpv6_timeout string 60 # If you want the preconfiguration file to work on systems both with and # without a dhcp server, uncomment these lines and the static network @@ -160,9 +158,6 @@ d-i apt-setup/cdrom/set-next boolean false d-i apt-setup/cdrom/set-failed boolean false d-i apt-setup/disable-cdrom-entries boolean true d-i apt-setup/enable-source-repositories boolean true -# You can choose to install non-free and contrib software. -d-i apt-setup/non-free boolean true -d-i apt-setup/contrib boolean true # Disable upgrading while installation d-i pkgsel/upgrade select none diff --git a/autoinstall/README.md b/autoinstall/README.md index 8c7457f1d..c9de11c82 100644 --- a/autoinstall/README.md +++ b/autoinstall/README.md @@ -18,7 +18,7 @@ 17. For UnionTech OS Server 20 1050e unattend auto-install, please use file UOS/Server/20/1050e/ks.cfg. 18. For Fedora Server 36 or later unattend auto-install, please use file Fedora/36/Server/ks.cfg. 19. For FreeBSD 13 or later unattend auto-install, please use file FreeBSD/installerconfig. -20. For Pardus 21.x or later unattend auto-install, please use file Pardus/preseed.cfg. +20. For Pardus 21.2 Server or later and 21.4 XFCE or later unattend auto-install, please use file Pardus/preseed.cfg. # Notes ## For Windows From 1da05206d9f3327f905d605f65b7553d8cc65cc2 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 10 May 2023 18:18:43 +0800 Subject: [PATCH 29/41] change code as codereview Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 06df69702..293aa81a7 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -16,8 +16,6 @@ d-i keyboard-configuration/xkb-keymap select us d-i keyboard-configuration/variant select English (US) ### Network configuration -# installations on non-networked devices where the network questions, -# warning and long timeouts are a nuisance. d-i netcfg/enable boolean true # netcfg will choose an interface that has link if possible. This makes it @@ -230,7 +228,11 @@ d-i preseed/late_command string \ chroot /target apt-get install -y --no-upgrade openssh-server > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ echo "Install package open-vm-tools-desktop if has desktop environment ..." > /target/dev/ttyS0; \ - if [ -f "/target/usr/bin/Xorg" ]; then chroot /target apt-get install -y open-vm-tools-desktop > /target/dev/ttyS0; fi; \ + if [ -f "/target/usr/bin/Xorg" ];\ + then\ + echo "Install package open-vm-tools-desktop ..." > /target/dev/ttyS0;\ + chroot /target apt-get install -y open-vm-tools-desktop > /target/dev/ttyS0;\ + fi; \ {% if new_user is defined and new_user != 'root' %} echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/target/etc/sudoers.d/{{ new_user }}; \ mkdir -p -m 700 /target/home/{{ new_user }}/.ssh; \ From 5e86df87f6ab7da386ae5de73222762354a7814b Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 10 May 2023 19:02:55 +0800 Subject: [PATCH 30/41] split big size file to multiple files as suggested Signed-off-by: ZouYuhua --- .../rebuild_debian_unattend_install_iso.yml | 93 ++++ .../rebuild_pardus_unattend_install_iso.yml | 143 ++++++ .../rebuild_photon_unattend_install_iso.yml | 44 ++ .../rebuild_ubuntu_unattend_install_iso.yml | 178 +++++++ .../rebuild_unattend_install_iso.yml | 450 +----------------- 5 files changed, 468 insertions(+), 440 deletions(-) create mode 100644 linux/deploy_vm/rebuild_debian_unattend_install_iso.yml create mode 100644 linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml create mode 100644 linux/deploy_vm/rebuild_photon_unattend_install_iso.yml create mode 100644 linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml diff --git a/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml b/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml new file mode 100644 index 000000000..a50f53c3a --- /dev/null +++ b/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml @@ -0,0 +1,93 @@ +# Copyright 2022-2023 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Rebuild OS ISO image with unattended install file +# Parameter: +# rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# +- name: "Extract specific files inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - 'boot/grub/grub.cfg' + - 'isolinux/isolinux.cfg' + - 'isolinux/gtk.cfg' + - 'md5sum.txt' + +- name: "Update timeout for boot menu" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "timeout 0" + replace: "timeout 1" + +- name: "Search string in md5sum.txt" + ansible.builtin.shell: grep '/install.386/' {{ src_iso_file_dir }}/md5sum.txt + ignore_errors: true + register: result_search_str + +- name: "Print the result of searching str in file md5sum.txt" + ansible.builtin.debug: var=result_search_str + +- name: "Set fact of Debian install type" + ansible.builtin.set_fact: + debian_install_type: |- + {%- if result_search_str.failed -%}install.amd + {%- else -%}install.386 + {%- endif -%} + +- debug: var=debian_install_type + +- name: "Update timeout for boot menu" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "default .*" + replace: "default installgui" + +- name: "Update Debian grub.cfg for autoinstall" + ansible.builtin.blockinfile: + path: "{{ src_iso_file_dir }}/grub.cfg" + block: | + set default="autoinstall" + set timeout=5 + menuentry "Automated installation" --id autoinstall { + set background_color=black + linux /{{ debian_install_type }}/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} vga=788 --- quiet + initrd /{{ debian_install_type }}/gtk/initrd.gz + } + +- name: "Update boot menu with preseed.cfg for Debian" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/gtk.cfg" + regexp: '(.*)(initrd.gz )(.*)' + replace: "\\1\\2 auto=true file=/cdrom/{{ unattend_install_file_name }} \\3" + +- name: "Update md5sum for Debian ISO files" + ansible.builtin.shell: "{{ item }}" + with_items: + - "sed -i '#./isolinux/isolinux.cfg#d' md5sum.txt" + - "echo \"`md5sum isolinux.cfg | awk '{print $1}'` ./isolinux/isolinux.cfg\" >>md5sum.txt" + - "sed -i '#./boot/grub/grub.cfg#d' md5sum.txt" + - "echo \"`md5sum grub.cfg | awk '{print $1}'` ./boot/grub/grub.cfg\" >>md5sum.txt" + args: + chdir: "{{ src_iso_file_dir }}" + register: update_initrd_output + +- name: "Print command output for updating initrd" + ansible.builtin.debug: var=update_initrd_output + +- name: "Customize the ISO" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "boot/grub/grub.cfg" + - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" + dest_file: "isolinux/isolinux.cfg" + - src_file: "{{ src_iso_file_dir }}/gtk.cfg" + dest_file: "isolinux/gtk.cfg" + - src_file: "{{ src_iso_file_dir }}/md5sum.txt" + dest_file: "md5sum.txt" + - src_file: "{{ new_unattend_install_conf }}" + dest_file: "{{ unattend_install_file_name }}" diff --git a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml new file mode 100644 index 000000000..d1d912b9b --- /dev/null +++ b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml @@ -0,0 +1,143 @@ +# Copyright 2022-2023 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Rebuild OS ISO image with unattended install file +# Parameter: +# rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# +- name: "Extract specific files inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - 'boot/grub/grub.cfg' + - 'isolinux/isolinux.cfg' + - 'isolinux/install_en.cfg' + - 'isolinux/install.cfg' + - 'md5sum.txt' + +- name: "Update timeout of file isolinux.cfg" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "timeout 0" + replace: "timeout 1" + +- name: "Update file isolinux.cfg" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "default .*" + replace: "default installgui" + +- name: "Update default boot label" + ansible.builtin.lineinfile: + path: "{{ src_iso_file_dir }}/{{ item }}" + insertbefore: "^label install$" + line: "default installgui" + with_items: + - "install_en.cfg" + - "install.cfg" + +- name: "Update boot parameters with preseed.cfg" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/{{ item }}" + regexp: '(.*)(append )(.*)' + replace: "\\1\\2 auto=true file=/cdrom/{{ unattend_install_file_name }} \\3" + with_items: + - "install_en.cfg" + - "install.cfg" + +- name: "Update default memuentry for grub.cfg" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/grub.cfg" + regexp: "set default=0" + replace: "set default=1\nset timeout=3" + +- name: "Update default boot entry for autoinstall" + ansible.builtin.lineinfile: + path: "{{ src_iso_file_dir }}/grub.cfg" + insertafter: "^submenu.*English.*{#" + line: ' set default="autoinstall"' + +- name: "Update boot parameters for autoinstall" + ansible.builtin.blockinfile: + path: "{{ src_iso_file_dir }}/grub.cfg" + insertafter: ".*autoinstall.*" + block: | + # menuentry for unattended installation + menuentry "Automated installation" --id autoinstall { + set background_color=black + linux /install/gtk/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} video=vesa:ywrap,mtrr vga=788 --- quiet + initrd /install/gtk/initrd.gz + } + +- name: "Update md5sum for Pardus ISO files" + ansible.builtin.shell: "{{ item }}" + with_items: + - "sed -i '#./isolinux/isolinux.cfg#d' md5sum.txt" + - "echo \"`md5sum isolinux.cfg | awk '{print $1}'` ./isolinux/isolinux.cfg\" >>md5sum.txt" + - "sed -i '#./boot/grub/grub.cfg#d' md5sum.txt" + - "echo \"`md5sum grub.cfg | awk '{print $1}'` ./boot/grub/grub.cfg\" >>md5sum.txt" + - "sed -i '#./isolinux/install_en.cfg#d' md5sum.txt" + - "echo \"`md5sum install_en.cfg | awk '{print $1}'` ./isolinux/install_en.cfg\" >>md5sum.txt" + - "sed -i '#./isolinux/install.cfg#d' md5sum.txt" + - "echo \"`md5sum install.cfg | awk '{print $1}'` ./isolinux/install.cfg\" >>md5sum.txt" + args: + chdir: "{{ src_iso_file_dir }}" + register: update_initrd_output + +- name: "Print command output for updating initrd" + ansible.builtin.debug: var=update_initrd_output + +- name: "Get file to get code name" + ansible.builtin.shell: "cat {{ src_iso_file_dir }}/md5sum.txt | grep -E 'dists\\/[a-zA-Z]+\\/Release$' | cut -d. -f 2" + register: release_file_path + +- name: "Print release file path" + ansible.builtin.debug: var=release_file_path + +- name: "Extract specific release file inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - "{{ release_file_path.stdout.split('/', 1)[-1] }}" + +- name: "Get codename of the ISO distribution" + ansible.builtin.shell: "cat {{ src_iso_file_dir }}/Release | grep Codename | cut -d: -f 2" + register: codename_output + +- name: "Set facts of the codename" + ansible.builtin.set_fact: + os_codename: "{{ codename_output.stdout.strip() }}" + +- name: "Print codename" + ansible.builtin.debug: var=os_codename + +- name: "Replace the codename in file preseed.cfg" + ansible.builtin.replace: + path: "{{ new_unattend_install_conf }}" + regexp: "yirmibir" + replace: "{{ os_codename }}" + +- name: "Print the content of unattend install config file after replace codename" + ansible.builtin.debug: + msg: "{{ lookup('file', new_unattend_install_conf) | split('\n') }}" + +- name: "Customize the ISO" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "boot/grub/grub.cfg" + - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" + dest_file: "isolinux/isolinux.cfg" + - src_file: "{{ src_iso_file_dir }}/install_en.cfg" + dest_file: "isolinux/install_en.cfg" + - src_file: "{{ src_iso_file_dir }}/install.cfg" + dest_file: "isolinux/install.cfg" + - src_file: "{{ src_iso_file_dir }}/md5sum.txt" + dest_file: "md5sum.txt" + - src_file: "{{ new_unattend_install_conf }}" + dest_file: "{{ unattend_install_file_name }}" + diff --git a/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml b/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml new file mode 100644 index 000000000..37c067dd8 --- /dev/null +++ b/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml @@ -0,0 +1,44 @@ +# Copyright 2022-2023 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Rebuild OS ISO image with unattended install file +# Parameter: +# rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# +- name: "Extract specific files inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - 'boot/grub2/grub.cfg' + - 'isolinux/isolinux.cfg' + - 'isolinux/menu.cfg' + +- name: "Update timeout for boot menu" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + regexp: "timeout 0" + replace: "timeout 1" + +- name: "Update boot menu with kickstart for VMware Photon OS" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/{{ item }}" + regexp: '(.*)(root=[^ ]+)(.*)' + replace: "\\1\\2 ks=cdrom:/isolinux/{{ unattend_install_file_name }} \\3" + with_items: + - "menu.cfg" + - "grub.cfg" + +- name: "Customize the ISO" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/menu.cfg" + dest_file: "isolinux/menu.cfg" + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "boot/grub2/grub.cfg" + - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" + dest_file: "isolinux/isolinux.cfg" + - src_file: "{{ new_unattend_install_conf }}" + dest_file: "isolinux/{{ unattend_install_file_name }}" diff --git a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml new file mode 100644 index 000000000..0ed56e26e --- /dev/null +++ b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml @@ -0,0 +1,178 @@ +# Copyright 2022-2023 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Rebuild OS ISO image with unattended install file +# Parameter: +# rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# +- name: "Rebuild ISO for Ubuntu 20.04 ~ 22.10 desktop" + block: + - name: "Extract specific files inside ISO" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - "boot/grub/grub.cfg" + + - name: "Modify boot entry" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/grub.cfg" + regexp: "set timeout=[1-9][0-9]{0,1}" + replace: "default=0\nset timeout=2" + + - name: "Modify boot options" + ansible.builtin.replace: + path: "{{ src_iso_file_dir }}/grub.cfg" + regexp: "file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash ---" + replace: "file=/cdrom/preseed/ubuntu.seed boot=casper debug-ubiquity automatic-ubiquity quiet splash noprompt --- console=ttyS0,115200n8" + + - name: "Print the content of modified file grub.cfg" + ansible.builtin.debug: + msg: "{{ lookup('file', src_iso_file_dir + '/grub.cfg') }}" + + - name: "Extract isolinux/isolinux.cfg inside ISO for old releases" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - "isolinux/isolinux.cfg" + ignore_errors: true + register: result_extract_file + + - name: "Modify isolinux.cfg for some old releases such as Ubuntu 20.04 when the firmware is bios" + block: + - name: "Modify boot option" + ansible.builtin.blockinfile: + path: "{{ src_iso_file_dir }}/isolinux.cfg" + insertafter: "^#.*etc.*" + block: | + default live-install + label live-install + menu label ^Install Ubuntu + kernel /casper/vmlinuz + append file=/cdrom/preseed/ubuntu.seed boot=casper debug-ubiquity automatic-ubiquity initrd=/casper/initrd quiet splash noprompt --- console=ttyS0,115200n8 + + - name: "Print the content of modified file isolinux.cfg" + ansible.builtin.debug: + msg: "{{ lookup('file', src_iso_file_dir + '/isolinux.cfg') }}" + + - name: "Customize the ISO with isolinux/isolinux.cfg" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "/boot/grub/grub.cfg" + - src_file: "{{ new_unattend_install_conf }}" + dest_file: "/preseed/ubuntu.seed" + - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" + dest_file: "/isolinux/isolinux.cfg" + when: + - result_extract_file is defined + - result_extract_file.failed is defined + - not result_extract_file.failed + + - name: "Customize the ISO without isolinux/isolinux.cfg" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "/boot/grub/grub.cfg" + - src_file: "{{ new_unattend_install_conf }}" + dest_file: "/preseed/ubuntu.seed" + when: + - result_extract_file is defined + - result_extract_file.failed is defined + - result_extract_file.failed + when: unattend_install_conf is match('Ubuntu/Desktop/Ubiquity') + +- name: "Rebuild ISO for Ubuntu live server" + block: + - name: Extract specific files inside ISO + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - 'boot/grub/grub.cfg' + - 'md5sum.txt' + + - name: "Add autoinstall to UEFI boot kernel command for Ubuntu live server" + ansible.builtin.replace: + path: "{{ unattend_iso_cache }}/grub.cfg" + regexp: '(.*vmlinuz)(.*)' + replace: "\\1 autoinstall \\2" + when: unattend_install_conf is match('Ubuntu/Server') or unattend_install_conf is match('Ubuntu/Desktop/Subiquity') + + - name: "Set timeout to 5 seconds at boot menu" + ansible.builtin.replace: + path: "{{ unattend_iso_cache }}/grub.cfg" + regexp: 'set timeout=.*' + replace: "set timeout=5" + + - name: "Update md5sum for UEFI boot config file" + ansible.builtin.shell: | + md5=`md5sum grub.cfg | awk '{print $1}'` + sed -i "/.\/boot\/grub\/grub.cfg/ s/^[^ ]*/$md5/" md5sum.txt + args: + chdir: "{{ unattend_iso_cache }}" + + - name: "set var ubuntu_bios_cfg_exist to default false" + ansible.builtin.set_fact: + ubuntu_bios_cfg_exist: false + + - name: "Extract isolinux/txt.cfg inside ISO if exists" + community.general.iso_extract: + image: "{{ src_iso_file_path }}" + dest: "{{ src_iso_file_dir }}" + files: + - 'isolinux/txt.cfg' + register: check_file_result + ignore_errors: true + + - debug: var=check_file_result + + - name: "set var ubuntu_bios_cfg_exist to true or not" + ansible.builtin.set_fact: + ubuntu_bios_cfg_exist: true + when: not check_file_result.failed + + - name: "Update BIOS boot config file if it exists and Customize ISO" + block: + - name: "Add autoinstall to BIOS boot kernel command for Ubuntu live server" + ansible.builtin.replace: + path: "{{ unattend_iso_cache }}/txt.cfg" + regexp: '(.*initrd)(.*)' + replace: "\\1 autoinstall \\2" + + - name: "Update md5sum for BIOS boot config file" + ansible.builtin.shell: | + md5=`md5sum txt.cfg | awk '{print $1}'` + sed -i "/.\/isolinux\/txt.cfg/ s/^[^ ]*/$md5/" md5sum.txt + args: + chdir: "{{ unattend_iso_cache }}" + + - name: "Customize the ISO" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "boot/grub/grub.cfg" + - src_file: "{{ src_iso_file_dir }}/md5sum.txt" + dest_file: "md5sum.txt" + - src_file: "{{ src_iso_file_dir }}/txt.cfg" + dest_file: "isolinux/txt.cfg" + when: ubuntu_bios_cfg_exist + + - name: "Customize the ISO without txt.cfg" + community.general.iso_customize: + src_iso: "{{ src_iso_file_path }}" + dest_iso: "{{ rebuilt_unattend_iso_path }}" + add_files: + - src_file: "{{ src_iso_file_dir }}/grub.cfg" + dest_file: "boot/grub/grub.cfg" + - src_file: "{{ src_iso_file_dir }}/md5sum.txt" + dest_file: "md5sum.txt" + when: not ubuntu_bios_cfg_exist + when: unattend_install_conf is match('Ubuntu/Server') or unattend_install_conf is match('Ubuntu/Desktop/Subiquity') diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 3238090fb..7d6966a9f 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -28,308 +28,17 @@ ansible.builtin.set_fact: unattend_install_file_name: "{{ new_unattend_install_conf | basename }}" -- name: "Rebuild ISO for Ubuntu 20.04 ~ 22.10 desktop" - block: - - name: "Extract specific files inside ISO" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - "boot/grub/grub.cfg" - - - name: "Modify boot entry" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/grub.cfg" - regexp: "set timeout=[1-9][0-9]{0,1}" - replace: "default=0\nset timeout=2" - - - name: "Modify boot options" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/grub.cfg" - regexp: "file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash ---" - replace: "file=/cdrom/preseed/ubuntu.seed boot=casper debug-ubiquity automatic-ubiquity quiet splash noprompt --- console=ttyS0,115200n8" - - - name: "Print the content of modified file grub.cfg" - ansible.builtin.debug: - msg: "{{ lookup('file', src_iso_file_dir + '/grub.cfg') }}" - - - name: "Extract isolinux/isolinux.cfg inside ISO for old releases" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - "isolinux/isolinux.cfg" - ignore_errors: true - register: result_extract_file - - - name: "Modify isolinux.cfg for some old releases such as Ubuntu 20.04 when the firmware is bios" - block: - - name: "Modify boot option" - ansible.builtin.blockinfile: - path: "{{ src_iso_file_dir }}/isolinux.cfg" - insertafter: "^#.*etc.*" - block: | - default live-install - label live-install - menu label ^Install Ubuntu - kernel /casper/vmlinuz - append file=/cdrom/preseed/ubuntu.seed boot=casper debug-ubiquity automatic-ubiquity initrd=/casper/initrd quiet splash noprompt --- console=ttyS0,115200n8 - - - name: "Print the content of modified file isolinux.cfg" - ansible.builtin.debug: - msg: "{{ lookup('file', src_iso_file_dir + '/isolinux.cfg') }}" - - - name: "Customize the ISO with isolinux/isolinux.cfg" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "/boot/grub/grub.cfg" - - src_file: "{{ new_unattend_install_conf }}" - dest_file: "/preseed/ubuntu.seed" - - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" - dest_file: "/isolinux/isolinux.cfg" - when: - - result_extract_file is defined - - result_extract_file.failed is defined - - not result_extract_file.failed - - - name: "Customize the ISO without isolinux/isolinux.cfg" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "/boot/grub/grub.cfg" - - src_file: "{{ new_unattend_install_conf }}" - dest_file: "/preseed/ubuntu.seed" - when: - - result_extract_file is defined - - result_extract_file.failed is defined - - result_extract_file.failed - when: unattend_install_conf is match('Ubuntu/Desktop/Ubiquity') - -- name: "Rebuild ISO for Photon" - block: - - name: "Extract specific files inside ISO" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - 'boot/grub2/grub.cfg' - - 'isolinux/isolinux.cfg' - - 'isolinux/menu.cfg' - - - name: "Update timeout for boot menu" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/isolinux.cfg" - regexp: "timeout 0" - replace: "timeout 1" - - - name: "Update boot menu with kickstart for VMware Photon OS" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/{{ item }}" - regexp: '(.*)(root=[^ ]+)(.*)' - replace: "\\1\\2 ks=cdrom:/isolinux/{{ unattend_install_file_name }} \\3" - with_items: - - "menu.cfg" - - "grub.cfg" - - - name: "Customize the ISO" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/menu.cfg" - dest_file: "isolinux/menu.cfg" - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "boot/grub2/grub.cfg" - - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" - dest_file: "isolinux/isolinux.cfg" - - src_file: "{{ new_unattend_install_conf }}" - dest_file: "isolinux/{{ unattend_install_file_name }}" - when: unattend_install_conf is match('Photon') - -- name: "Rebuild ISO for Debian" - block: - - name: "Extract specific files inside ISO" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - 'boot/grub/grub.cfg' - - 'isolinux/isolinux.cfg' - - 'isolinux/gtk.cfg' - - 'md5sum.txt' - - - name: "Update timeout for boot menu" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/isolinux.cfg" - regexp: "timeout 0" - replace: "timeout 1" - - - name: "Search string in md5sum.txt" - ansible.builtin.shell: grep '/install.386/' {{ src_iso_file_dir }}/md5sum.txt - ignore_errors: true - register: result_search_str - - - name: "Print the result of searching str in file md5sum.txt" - ansible.builtin.debug: var=result_search_str - - - name: "Set fact of Debian install type" - ansible.builtin.set_fact: - debian_install_type: |- - {%- if result_search_str.failed -%}install.amd - {%- else -%}install.386 - {%- endif -%} - - - debug: var=debian_install_type - - - name: "Update timeout for boot menu" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/isolinux.cfg" - regexp: "default .*" - replace: "default installgui" - - - name: "Update Debian grub.cfg for autoinstall" - ansible.builtin.blockinfile: - path: "{{ src_iso_file_dir }}/grub.cfg" - block: | - set default="autoinstall" - set timeout=5 - menuentry "Automated installation" --id autoinstall { - set background_color=black - linux /{{ debian_install_type }}/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} vga=788 --- quiet - initrd /{{ debian_install_type }}/gtk/initrd.gz - } - - - name: "Update boot menu with preseed.cfg for Debian" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/gtk.cfg" - regexp: '(.*)(initrd.gz )(.*)' - replace: "\\1\\2 auto=true file=/cdrom/{{ unattend_install_file_name }} \\3" - - - name: "Update md5sum for Debian ISO files" - ansible.builtin.shell: "{{ item }}" - with_items: - - "sed -i '#./isolinux/isolinux.cfg#d' md5sum.txt" - - "echo \"`md5sum isolinux.cfg | awk '{print $1}'` ./isolinux/isolinux.cfg\" >>md5sum.txt" - - "sed -i '#./boot/grub/grub.cfg#d' md5sum.txt" - - "echo \"`md5sum grub.cfg | awk '{print $1}'` ./boot/grub/grub.cfg\" >>md5sum.txt" - args: - chdir: "{{ src_iso_file_dir }}" - register: update_initrd_output - - - name: "Print command output for updating initrd" - ansible.builtin.debug: var=update_initrd_output - - - name: "Customize the ISO" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "boot/grub/grub.cfg" - - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" - dest_file: "isolinux/isolinux.cfg" - - src_file: "{{ src_iso_file_dir }}/gtk.cfg" - dest_file: "isolinux/gtk.cfg" - - src_file: "{{ src_iso_file_dir }}/md5sum.txt" - dest_file: "md5sum.txt" - - src_file: "{{ new_unattend_install_conf }}" - dest_file: "{{ unattend_install_file_name }}" - when: unattend_install_conf is match('Debian') - -- name: "Rebuild ISO for Ubuntu live server" - block: - - name: Extract specific files inside ISO - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - 'boot/grub/grub.cfg' - - 'md5sum.txt' - - - name: "Add autoinstall to UEFI boot kernel command for Ubuntu live server" - ansible.builtin.replace: - path: "{{ unattend_iso_cache }}/grub.cfg" - regexp: '(.*vmlinuz)(.*)' - replace: "\\1 autoinstall \\2" - when: unattend_install_conf is match('Ubuntu/Server') or unattend_install_conf is match('Ubuntu/Desktop/Subiquity') - - - name: "Set timeout to 5 seconds at boot menu" - ansible.builtin.replace: - path: "{{ unattend_iso_cache }}/grub.cfg" - regexp: 'set timeout=.*' - replace: "set timeout=5" - - - name: "Update md5sum for UEFI boot config file" - ansible.builtin.shell: | - md5=`md5sum grub.cfg | awk '{print $1}'` - sed -i "/.\/boot\/grub\/grub.cfg/ s/^[^ ]*/$md5/" md5sum.txt - args: - chdir: "{{ unattend_iso_cache }}" - - - name: "set var ubuntu_bios_cfg_exist to default false" - ansible.builtin.set_fact: - ubuntu_bios_cfg_exist: false - - - name: "Extract isolinux/txt.cfg inside ISO if exists" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - 'isolinux/txt.cfg' - register: check_file_result - ignore_errors: true - - - debug: var=check_file_result - - - name: "set var ubuntu_bios_cfg_exist to true or not" - ansible.builtin.set_fact: - ubuntu_bios_cfg_exist: true - when: not check_file_result.failed - - - name: "Update BIOS boot config file if it exists and Customize ISO" - block: - - name: "Add autoinstall to BIOS boot kernel command for Ubuntu live server" - ansible.builtin.replace: - path: "{{ unattend_iso_cache }}/txt.cfg" - regexp: '(.*initrd)(.*)' - replace: "\\1 autoinstall \\2" - - - name: "Update md5sum for BIOS boot config file" - ansible.builtin.shell: | - md5=`md5sum txt.cfg | awk '{print $1}'` - sed -i "/.\/isolinux\/txt.cfg/ s/^[^ ]*/$md5/" md5sum.txt - args: - chdir: "{{ unattend_iso_cache }}" - - - name: "Customize the ISO" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "boot/grub/grub.cfg" - - src_file: "{{ src_iso_file_dir }}/md5sum.txt" - dest_file: "md5sum.txt" - - src_file: "{{ src_iso_file_dir }}/txt.cfg" - dest_file: "isolinux/txt.cfg" - when: ubuntu_bios_cfg_exist +- name: "Set fact of unattend install config file name" + ansible.builtin.set_fact: + unattend_install_os_type: "{{ unattend_install_conf.split('/')[0] | lower }}" - - name: "Customize the ISO without txt.cfg" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "boot/grub/grub.cfg" - - src_file: "{{ src_iso_file_dir }}/md5sum.txt" - dest_file: "md5sum.txt" - when: not ubuntu_bios_cfg_exist - when: unattend_install_conf is match('Ubuntu/Server') or unattend_install_conf is match('Ubuntu/Desktop/Subiquity') +- name: "rebuild ISO for {{ unattend_install_os_type }}" + include_tasks: "rebuild_{{ unattend_install_os_type }}_unattend_install_iso.yml" + when: > + unattend_install_os_type == "photon" or + unattend_install_os_type == "debian" or + unattend_install_os_type == "ubuntu" or + unattend_install_os_type == "pardus" - name: "Rebuild ISO for FreeBSD" community.general.iso_customize: @@ -339,142 +48,3 @@ - src_file: "{{ new_unattend_install_conf }}" dest_file: "/etc/installerconfig" when: unattend_install_conf is match('FreeBSD') - -- name: "Rebuild ISO for Pardus" - block: - - name: "Extract specific files inside ISO" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - 'boot/grub/grub.cfg' - - 'isolinux/isolinux.cfg' - - 'isolinux/install_en.cfg' - - 'isolinux/install.cfg' - - 'md5sum.txt' - - - name: "Update timeout of file isolinux.cfg" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/isolinux.cfg" - regexp: "timeout 0" - replace: "timeout 1" - - - name: "Update file isolinux.cfg" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/isolinux.cfg" - regexp: "default .*" - replace: "default installgui" - - - name: "Update default boot label" - ansible.builtin.lineinfile: - path: "{{ src_iso_file_dir }}/{{ item }}" - insertbefore: "^label install$" - line: "default installgui" - with_items: - - "install_en.cfg" - - "install.cfg" - - - name: "Update boot parameters with preseed.cfg" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/{{ item }}" - regexp: '(.*)(append )(.*)' - replace: "\\1\\2 auto=true file=/cdrom/{{ unattend_install_file_name }} \\3" - with_items: - - "install_en.cfg" - - "install.cfg" - - - name: "Update default memuentry for grub.cfg" - ansible.builtin.replace: - path: "{{ src_iso_file_dir }}/grub.cfg" - regexp: "set default=0" - replace: "set default=1\nset timeout=3" - - - name: "Update default boot entry for autoinstall" - ansible.builtin.lineinfile: - path: "{{ src_iso_file_dir }}/grub.cfg" - insertafter: "^submenu.*English.*{#" - line: ' set default="autoinstall"' - - - name: "Update boot parameters for autoinstall" - ansible.builtin.blockinfile: - path: "{{ src_iso_file_dir }}/grub.cfg" - insertafter: ".*autoinstall.*" - block: | - # menuentry for unattended installation - menuentry "Automated installation" --id autoinstall { - set background_color=black - linux /install/gtk/vmlinuz auto=true file=/cdrom/{{ unattend_install_file_name }} video=vesa:ywrap,mtrr vga=788 --- quiet - initrd /install/gtk/initrd.gz - } - - - name: "Update md5sum for Pardus ISO files" - ansible.builtin.shell: "{{ item }}" - with_items: - - "sed -i '#./isolinux/isolinux.cfg#d' md5sum.txt" - - "echo \"`md5sum isolinux.cfg | awk '{print $1}'` ./isolinux/isolinux.cfg\" >>md5sum.txt" - - "sed -i '#./boot/grub/grub.cfg#d' md5sum.txt" - - "echo \"`md5sum grub.cfg | awk '{print $1}'` ./boot/grub/grub.cfg\" >>md5sum.txt" - - "sed -i '#./isolinux/install_en.cfg#d' md5sum.txt" - - "echo \"`md5sum install_en.cfg | awk '{print $1}'` ./isolinux/install_en.cfg\" >>md5sum.txt" - - "sed -i '#./isolinux/install.cfg#d' md5sum.txt" - - "echo \"`md5sum install.cfg | awk '{print $1}'` ./isolinux/install.cfg\" >>md5sum.txt" - args: - chdir: "{{ src_iso_file_dir }}" - register: update_initrd_output - - - name: "Print command output for updating initrd" - ansible.builtin.debug: var=update_initrd_output - - - name: "Get file to get code name" - ansible.builtin.shell: "cat {{ src_iso_file_dir }}/md5sum.txt | grep -E 'dists\\/[a-zA-Z]+\\/Release$' | cut -d. -f 2" - register: release_file_path - - - name: "Print release file path" - ansible.builtin.debug: var=release_file_path - - - name: "Extract specific release file inside ISO" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - "{{ release_file_path.stdout.split('/', 1)[-1] }}" - - - name: "Get codename of the ISO distribution" - ansible.builtin.shell: "cat {{ src_iso_file_dir }}/Release | grep Codename | cut -d: -f 2" - register: codename_output - - - name: "Set facts of the codename" - ansible.builtin.set_fact: - os_codename: "{{ codename_output.stdout.strip() }}" - - - name: "Print codename" - ansible.builtin.debug: var=os_codename - - - name: "Replace the codename in file preseed.cfg" - ansible.builtin.replace: - path: "{{ new_unattend_install_conf }}" - regexp: "yirmibir" - replace: "{{ os_codename }}" - - - name: "Print the content of unattend install config file after replace codename" - ansible.builtin.debug: - msg: "{{ lookup('file', new_unattend_install_conf) | split('\n') }}" - - - name: "Customize the ISO" - community.general.iso_customize: - src_iso: "{{ src_iso_file_path }}" - dest_iso: "{{ rebuilt_unattend_iso_path }}" - add_files: - - src_file: "{{ src_iso_file_dir }}/grub.cfg" - dest_file: "boot/grub/grub.cfg" - - src_file: "{{ src_iso_file_dir }}/isolinux.cfg" - dest_file: "isolinux/isolinux.cfg" - - src_file: "{{ src_iso_file_dir }}/install_en.cfg" - dest_file: "isolinux/install_en.cfg" - - src_file: "{{ src_iso_file_dir }}/install.cfg" - dest_file: "isolinux/install.cfg" - - src_file: "{{ src_iso_file_dir }}/md5sum.txt" - dest_file: "md5sum.txt" - - src_file: "{{ new_unattend_install_conf }}" - dest_file: "{{ unattend_install_file_name }}" - when: unattend_install_conf is match('Pardus') \ No newline at end of file From 5c7c8cbf38c6cbd9b1080af92ae6971b906b8b08 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 10 May 2023 20:13:35 +0800 Subject: [PATCH 31/41] change code as codereview Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 1 - linux/deploy_vm/rebuild_debian_unattend_install_iso.yml | 6 ++++-- linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml | 6 ++++-- linux/deploy_vm/rebuild_photon_unattend_install_iso.yml | 6 ++++-- linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml | 8 +++++--- linux/deploy_vm/rebuild_unattend_install_iso.yml | 8 ++------ 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 293aa81a7..2334b040e 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -227,7 +227,6 @@ d-i preseed/late_command string \ chroot /target apt-get update -y > /dev/ttyS0; \ chroot /target apt-get install -y --no-upgrade openssh-server > /dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ - echo "Install package open-vm-tools-desktop if has desktop environment ..." > /target/dev/ttyS0; \ if [ -f "/target/usr/bin/Xorg" ];\ then\ echo "Install package open-vm-tools-desktop ..." > /target/dev/ttyS0;\ diff --git a/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml b/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml index a50f53c3a..8c5cdcd74 100644 --- a/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml @@ -1,9 +1,11 @@ -# Copyright 2022-2023 VMware, Inc. +# Copyright 2023 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause --- -# Rebuild OS ISO image with unattended install file +# Rebuild Debian ISO image with unattended install file # Parameter: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# src_iso_file_path: Local path of source ISO image file +# src_iso_file_dir: Local dir of source ISO image file # - name: "Extract specific files inside ISO" community.general.iso_extract: diff --git a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml index d1d912b9b..206b68f1a 100644 --- a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml @@ -1,9 +1,11 @@ -# Copyright 2022-2023 VMware, Inc. +# Copyright 2023 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause --- -# Rebuild OS ISO image with unattended install file +# Rebuild Pardus ISO image with unattended install file # Parameter: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# src_iso_file_path: Local path of source ISO image file +# src_iso_file_dir: Local dir of source ISO image file # - name: "Extract specific files inside ISO" community.general.iso_extract: diff --git a/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml b/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml index 37c067dd8..7ba460e29 100644 --- a/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml @@ -1,9 +1,11 @@ -# Copyright 2022-2023 VMware, Inc. +# Copyright 2023 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause --- -# Rebuild OS ISO image with unattended install file +# Rebuild Photon ISO image with unattended install file # Parameter: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# src_iso_file_path: Local path of source ISO image file +# src_iso_file_dir: Local dir of source ISO image file # - name: "Extract specific files inside ISO" community.general.iso_extract: diff --git a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml index 0ed56e26e..11dc4c30f 100644 --- a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml @@ -1,9 +1,11 @@ -# Copyright 2022-2023 VMware, Inc. +# Copyright 2023 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause --- -# Rebuild OS ISO image with unattended install file +# Rebuild Ubuntu ISO image with unattended install file # Parameter: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file +# src_iso_file_path: Local path of source ISO image file +# src_iso_file_dir: Local dir of source ISO image file # - name: "Rebuild ISO for Ubuntu 20.04 ~ 22.10 desktop" block: @@ -87,7 +89,7 @@ - result_extract_file.failed when: unattend_install_conf is match('Ubuntu/Desktop/Ubiquity') -- name: "Rebuild ISO for Ubuntu live server" +- name: "Rebuild ISO for Ubuntu live server / Ubuntu 23.04 or later Desktop" block: - name: Extract specific files inside ISO community.general.iso_extract: diff --git a/linux/deploy_vm/rebuild_unattend_install_iso.yml b/linux/deploy_vm/rebuild_unattend_install_iso.yml index 7d6966a9f..82ab7192e 100644 --- a/linux/deploy_vm/rebuild_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_unattend_install_iso.yml @@ -34,11 +34,7 @@ - name: "rebuild ISO for {{ unattend_install_os_type }}" include_tasks: "rebuild_{{ unattend_install_os_type }}_unattend_install_iso.yml" - when: > - unattend_install_os_type == "photon" or - unattend_install_os_type == "debian" or - unattend_install_os_type == "ubuntu" or - unattend_install_os_type == "pardus" + when: unattend_install_os_type in ["photon", "debian", "ubuntu", "pardus"] - name: "Rebuild ISO for FreeBSD" community.general.iso_customize: @@ -47,4 +43,4 @@ add_files: - src_file: "{{ new_unattend_install_conf }}" dest_file: "/etc/installerconfig" - when: unattend_install_conf is match('FreeBSD') + when: unattend_install_os_type == "freebsd" From 07b034dc5f4c68febc35ae10b4cb116763981f2a Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Wed, 10 May 2023 20:17:59 +0800 Subject: [PATCH 32/41] modify code as codereview Signed-off-by: ZouYuhua --- linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml index 11dc4c30f..76e61249c 100644 --- a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml @@ -104,7 +104,6 @@ path: "{{ unattend_iso_cache }}/grub.cfg" regexp: '(.*vmlinuz)(.*)' replace: "\\1 autoinstall \\2" - when: unattend_install_conf is match('Ubuntu/Server') or unattend_install_conf is match('Ubuntu/Desktop/Subiquity') - name: "Set timeout to 5 seconds at boot menu" ansible.builtin.replace: From 46ec4a4951842b5b66f122651aafc6e5dbc077af Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 11:32:17 +0800 Subject: [PATCH 33/41] change code from codereview Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 18 ++++++++-- common/test_rescue.yml | 1 - linux/deploy_vm/deploy_vm_from_iso.yml | 13 +++++++ .../rebuild_pardus_unattend_install_iso.yml | 35 ------------------- 4 files changed, 29 insertions(+), 38 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 2334b040e..182ce74c0 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -213,6 +213,7 @@ d-i finish-install/reboot_in_progress note # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. +# The packages not available in CDROM will be installed from online repo. d-i preseed/late_command string \ echo "Check network ..." > /target/dev/ttyS0; \ ip addr show > /target/dev/ttyS0; \ @@ -223,9 +224,22 @@ d-i preseed/late_command string \ ip addr show > /target/dev/ttyS0; \ echo "Check file /etc/apt/sources.list ..." > /target/dev/ttyS0; \ cat /target/etc/apt/sources.list > /target/dev/ttyS0; \ - echo "Install packages ..." > /target/dev/ttyS0; \ + if [ -f "/target/etc/os-release" ];\ + then\ + echo "Add offical repo ..." > /target/dev/ttyS0;\ + codename=$(cat /target/etc/os-release | grep PARDUS_CODENAME | cut -d= -f2);\ + chroot /target add-apt-repository "deb http://depo.pardus.org.tr/pardus $codename man contrib non-free";\ + chroot /target add-apt-repository "deb http://depo.pardus.org.tr/guvenlik $codename man contrib non-free";\ + cat /target/etc/apt/sources.list > /target/dev/ttyS0;\ + fi; \ + echo "Update repository ..." > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ - chroot /target apt-get install -y --no-upgrade openssh-server > /dev/ttyS0; \ + if [ ! -f "/target/etc/ssh/sshd_config" ];\ + then\ + echo "Install openssh-server ..." > /target/dev/ttyS0;\ + chroot /target apt-get install -y openssh-server > /dev/ttyS0;\ + fi; \ + echo "Install packages ..." > /target/dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ if [ -f "/target/usr/bin/Xorg" ];\ then\ diff --git a/common/test_rescue.yml b/common/test_rescue.yml index 30a9e0c71..8ff56e5e9 100644 --- a/common/test_rescue.yml +++ b/common/test_rescue.yml @@ -66,7 +66,6 @@ - vm_dir_name - vm_serial_port_output_file is defined - vm_serial_port_output_file - - guest_id is match('freebsd') - name: "Take a snapshot at VM current state" include_tasks: vm_take_snapshot.yml diff --git a/linux/deploy_vm/deploy_vm_from_iso.yml b/linux/deploy_vm/deploy_vm_from_iso.yml index 1ebfae5d1..e92a8b9b7 100644 --- a/linux/deploy_vm/deploy_vm_from_iso.yml +++ b/linux/deploy_vm/deploy_vm_from_iso.yml @@ -267,6 +267,19 @@ cdrom_controller_num: "{{ vm_cdroms[0].controller_number | int }}" cdrom_unit_num: "{{ vm_cdroms[0].unit_number | int }}" when: guest_os_ansible_distribution == "Ubuntu" + + - name: "Download serial output file before removing serial port" + include_tasks: ../../common/esxi_download_datastore_file.yml + vars: + src_datastore: "{{ datastore }}" + src_file_path: "{{ vm_dir_name }}/{{ vm_serial_port_output_file | basename }}" + dest_file_path: "{{ current_test_log_folder }}/{{ vm_serial_port_output_file | basename }}" + download_file_fail_ignore: true + when: + - vm_dir_name is defined + - vm_dir_name + - vm_serial_port_output_file is defined + - vm_serial_port_output_file - include_tasks: ../../common/vm_remove_serial_port.yml diff --git a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml index 206b68f1a..9a5e83260 100644 --- a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml @@ -90,41 +90,6 @@ - name: "Print command output for updating initrd" ansible.builtin.debug: var=update_initrd_output -- name: "Get file to get code name" - ansible.builtin.shell: "cat {{ src_iso_file_dir }}/md5sum.txt | grep -E 'dists\\/[a-zA-Z]+\\/Release$' | cut -d. -f 2" - register: release_file_path - -- name: "Print release file path" - ansible.builtin.debug: var=release_file_path - -- name: "Extract specific release file inside ISO" - community.general.iso_extract: - image: "{{ src_iso_file_path }}" - dest: "{{ src_iso_file_dir }}" - files: - - "{{ release_file_path.stdout.split('/', 1)[-1] }}" - -- name: "Get codename of the ISO distribution" - ansible.builtin.shell: "cat {{ src_iso_file_dir }}/Release | grep Codename | cut -d: -f 2" - register: codename_output - -- name: "Set facts of the codename" - ansible.builtin.set_fact: - os_codename: "{{ codename_output.stdout.strip() }}" - -- name: "Print codename" - ansible.builtin.debug: var=os_codename - -- name: "Replace the codename in file preseed.cfg" - ansible.builtin.replace: - path: "{{ new_unattend_install_conf }}" - regexp: "yirmibir" - replace: "{{ os_codename }}" - -- name: "Print the content of unattend install config file after replace codename" - ansible.builtin.debug: - msg: "{{ lookup('file', new_unattend_install_conf) | split('\n') }}" - - name: "Customize the ISO" community.general.iso_customize: src_iso: "{{ src_iso_file_path }}" From 745522c0a995625708c8799de0413192c2a66a1e Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 12:06:53 +0800 Subject: [PATCH 34/41] modify readme file Signed-off-by: ZouYuhua --- README.md | 1 + autoinstall/README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 582ae00e7..988bf0053 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ This project supports below scenarios for end-to-end guest operating system vali | UnionTech OS Server 20 1050a | :heavy_check_mark: | | :heavy_check_mark: | | Fedora Server 36 and later | :heavy_check_mark: | | :heavy_check_mark: | | ProLinux Server 7.9, 8.5 | :heavy_check_mark: | | :heavy_check_mark: | +| Pardus 21.2 Server and later | :heavy_check_mark: | | :heavy_check_mark: | Note: This compatible guest operating systems list is used for this project only. For guest operating system support status on ESXi, please refer to [VMware Compatibility Guide](https://www.vmware.com/resources/compatibility/search.php?deviceCategory=software&testConfig=16). diff --git a/autoinstall/README.md b/autoinstall/README.md index c9de11c82..f190b1adf 100644 --- a/autoinstall/README.md +++ b/autoinstall/README.md @@ -18,7 +18,7 @@ 17. For UnionTech OS Server 20 1050e unattend auto-install, please use file UOS/Server/20/1050e/ks.cfg. 18. For Fedora Server 36 or later unattend auto-install, please use file Fedora/36/Server/ks.cfg. 19. For FreeBSD 13 or later unattend auto-install, please use file FreeBSD/installerconfig. -20. For Pardus 21.2 Server or later and 21.4 XFCE or later unattend auto-install, please use file Pardus/preseed.cfg. +20. For Pardus 21.2 Server and XFCE Desktop or later unattend auto-install, please use file Pardus/preseed.cfg. # Notes ## For Windows From 419bf9da9a1655e8fdb3d4d6a60d37dde559c6f8 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 12:44:43 +0800 Subject: [PATCH 35/41] modify readme file Signed-off-by: ZouYuhua --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 988bf0053..10753bf47 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ This project supports below scenarios for end-to-end guest operating system vali | Fedora Server 36 and later | :heavy_check_mark: | | :heavy_check_mark: | | ProLinux Server 7.9, 8.5 | :heavy_check_mark: | | :heavy_check_mark: | | Pardus 21.2 Server and later | :heavy_check_mark: | | :heavy_check_mark: | +| Pardus 21.2 XFCE Desktop and later | :heavy_check_mark: | | :heavy_check_mark: | Note: This compatible guest operating systems list is used for this project only. For guest operating system support status on ESXi, please refer to [VMware Compatibility Guide](https://www.vmware.com/resources/compatibility/search.php?deviceCategory=software&testConfig=16). From 98a3ff4dd8813bf7da134eaabe9a10c7eb56d18e Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 13:17:48 +0800 Subject: [PATCH 36/41] move comment Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 182ce74c0..60c8d761c 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -1,14 +1,13 @@ #_preseed_V1 #### Contents of the preconfiguration file (for pardus) +### Localization +# Preseeding only locale sets language, country and locale. d-i debconf/language string en_US:en d-i debian-installer/country string US d-i debian-installer/fallbacklocale string en_US d-i debian-installer/language string en_US:en d-i languagechooser/locale string en - -### Localization -# Preseeding only locale sets language, country and locale. d-i debian-installer/locale string en_US # Keyboard selection. From 4f168ecfc948c4df8393db269a88542420f88e8c Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 13:44:19 +0800 Subject: [PATCH 37/41] modify preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 6 ------ 1 file changed, 6 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 60c8d761c..137e45f5d 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -129,12 +129,6 @@ d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true -# Add offical repo -d-i apt-setup/local0/repository string deb http://depo.pardus.org.tr/pardus yirmibir main contrib non-free -d-i apt-setup/local0/source boolean false -d-i apt-setup/local1/repository string deb http://depo.pardus.org.tr/guvenlik yirmibir main contrib non-free -d-i apt-setup/local1/source boolean false - # Default repository information (don't include codename data, d-i figures it # out from what's available in the ISO) #d-i mirror/country string manually From cf1654d020614aa8a699f8397bd4fb91af55e622 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 15:32:13 +0800 Subject: [PATCH 38/41] change file preseed.cfg Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 137e45f5d..44c11a80d 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -221,8 +221,8 @@ d-i preseed/late_command string \ then\ echo "Add offical repo ..." > /target/dev/ttyS0;\ codename=$(cat /target/etc/os-release | grep PARDUS_CODENAME | cut -d= -f2);\ - chroot /target add-apt-repository "deb http://depo.pardus.org.tr/pardus $codename man contrib non-free";\ - chroot /target add-apt-repository "deb http://depo.pardus.org.tr/guvenlik $codename man contrib non-free";\ + chroot /target add-apt-repository "deb http://depo.pardus.org.tr/pardus $codename main contrib non-free";\ + chroot /target add-apt-repository "deb http://depo.pardus.org.tr/guvenlik $codename main contrib non-free";\ cat /target/etc/apt/sources.list > /target/dev/ttyS0;\ fi; \ echo "Update repository ..." > /target/dev/ttyS0; \ From 89aece10d692803e6da4b93a0abc827c506e3040 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 17:43:22 +0800 Subject: [PATCH 39/41] 1. add-apt-repository does not work for pardus 21.2 server 2. sshd_config file doesn't exist after install openssh-server for pardus 21.4 XFCE Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index 44c11a80d..dea648c99 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -221,17 +221,14 @@ d-i preseed/late_command string \ then\ echo "Add offical repo ..." > /target/dev/ttyS0;\ codename=$(cat /target/etc/os-release | grep PARDUS_CODENAME | cut -d= -f2);\ - chroot /target add-apt-repository "deb http://depo.pardus.org.tr/pardus $codename main contrib non-free";\ - chroot /target add-apt-repository "deb http://depo.pardus.org.tr/guvenlik $codename main contrib non-free";\ + echo "deb http://depo.pardus.org.tr/pardus $codename main contrib non-free" > /target/etc/apt/sources.list;\ + echo "deb http://depo.pardus.org.tr/guvenlik $codename main contrib non-free" > /target/etc/apt/sources.list;\ cat /target/etc/apt/sources.list > /target/dev/ttyS0;\ fi; \ echo "Update repository ..." > /target/dev/ttyS0; \ chroot /target apt-get update -y > /dev/ttyS0; \ - if [ ! -f "/target/etc/ssh/sshd_config" ];\ - then\ - echo "Install openssh-server ..." > /target/dev/ttyS0;\ - chroot /target apt-get install -y openssh-server > /dev/ttyS0;\ - fi; \ + echo "Install openssh-server ..." > /target/dev/ttyS0; \ + chroot /target apt-get install -y --no-upgrade openssh-server > /dev/ttyS0; \ echo "Install packages ..." > /target/dev/ttyS0; \ chroot /target apt-get install -y --force-yes build-essential open-vm-tools sg3-utils vim > /dev/ttyS0; \ if [ -f "/target/usr/bin/Xorg" ];\ @@ -248,6 +245,8 @@ d-i preseed/late_command string \ echo "{{ ssh_public_key }}" > /target/root/.ssh/authorized_keys; \ chown --recursive root:root /target/root/.ssh; \ chmod 0644 /target/root/.ssh/authorized_keys; \ - sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config; \ - sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /target/etc/ssh/sshd_config; \ + echo "Config sshd to enable root login ..." > /target/dev/ttyS0; \ + touch /target/etc/ssh/sshd_config.d/root.conf; \ + echo "PasswordAuthentication yes" > /target/etc/ssh/sshd_config.d/root.conf; \ + echo "PermitRootLogin yes" > /target/etc/ssh/sshd_config.d/root.conf; \ echo "{{ autoinstall_complete_msg }}" > /target/dev/ttyS0 From 30d13bd293028dfa821457b38f1899ec75df5980 Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 18:29:56 +0800 Subject: [PATCH 40/41] 1. add-apt-repository does not work for pardus 21.2 server 2. sshd_config file doesn't exist after install openssh-server for pardus 21.4 XFCE Signed-off-by: ZouYuhua --- autoinstall/Pardus/preseed.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoinstall/Pardus/preseed.cfg b/autoinstall/Pardus/preseed.cfg index dea648c99..d2e78b4d7 100644 --- a/autoinstall/Pardus/preseed.cfg +++ b/autoinstall/Pardus/preseed.cfg @@ -221,8 +221,8 @@ d-i preseed/late_command string \ then\ echo "Add offical repo ..." > /target/dev/ttyS0;\ codename=$(cat /target/etc/os-release | grep PARDUS_CODENAME | cut -d= -f2);\ - echo "deb http://depo.pardus.org.tr/pardus $codename main contrib non-free" > /target/etc/apt/sources.list;\ - echo "deb http://depo.pardus.org.tr/guvenlik $codename main contrib non-free" > /target/etc/apt/sources.list;\ + echo "deb http://depo.pardus.org.tr/pardus $codename main contrib non-free" >> /target/etc/apt/sources.list;\ + echo "deb http://depo.pardus.org.tr/guvenlik $codename main contrib non-free" >> /target/etc/apt/sources.list;\ cat /target/etc/apt/sources.list > /target/dev/ttyS0;\ fi; \ echo "Update repository ..." > /target/dev/ttyS0; \ @@ -247,6 +247,6 @@ d-i preseed/late_command string \ chmod 0644 /target/root/.ssh/authorized_keys; \ echo "Config sshd to enable root login ..." > /target/dev/ttyS0; \ touch /target/etc/ssh/sshd_config.d/root.conf; \ - echo "PasswordAuthentication yes" > /target/etc/ssh/sshd_config.d/root.conf; \ - echo "PermitRootLogin yes" > /target/etc/ssh/sshd_config.d/root.conf; \ + echo "PasswordAuthentication yes" >> /target/etc/ssh/sshd_config.d/root.conf; \ + echo "PermitRootLogin yes" >> /target/etc/ssh/sshd_config.d/root.conf; \ echo "{{ autoinstall_complete_msg }}" > /target/dev/ttyS0 From c7f450cac650718da0af6ec8cef5a738e5a53a5d Mon Sep 17 00:00:00 2001 From: ZouYuhua Date: Thu, 11 May 2023 20:18:59 +0800 Subject: [PATCH 41/41] change parameter to parameters Signed-off-by: ZouYuhua --- linux/deploy_vm/rebuild_debian_unattend_install_iso.yml | 2 +- linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml | 2 +- linux/deploy_vm/rebuild_photon_unattend_install_iso.yml | 2 +- linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml b/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml index 8c5cdcd74..fa4d0d660 100644 --- a/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_debian_unattend_install_iso.yml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause --- # Rebuild Debian ISO image with unattended install file -# Parameter: +# Parameters: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file # src_iso_file_path: Local path of source ISO image file # src_iso_file_dir: Local dir of source ISO image file diff --git a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml index 9a5e83260..dfedea7bc 100644 --- a/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_pardus_unattend_install_iso.yml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause --- # Rebuild Pardus ISO image with unattended install file -# Parameter: +# Parameters: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file # src_iso_file_path: Local path of source ISO image file # src_iso_file_dir: Local dir of source ISO image file diff --git a/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml b/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml index 7ba460e29..f51f5ac53 100644 --- a/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_photon_unattend_install_iso.yml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause --- # Rebuild Photon ISO image with unattended install file -# Parameter: +# Parameters: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file # src_iso_file_path: Local path of source ISO image file # src_iso_file_dir: Local dir of source ISO image file diff --git a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml index 76e61249c..b45fe9455 100644 --- a/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml +++ b/linux/deploy_vm/rebuild_ubuntu_unattend_install_iso.yml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause --- # Rebuild Ubuntu ISO image with unattended install file -# Parameter: +# Parameters: # rebuilt_unattend_iso_path: Local path to the rebuilt ISO image with unattend install config file # src_iso_file_path: Local path of source ISO image file # src_iso_file_dir: Local dir of source ISO image file