-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Pardus] suppport unattended install for Pardus 21.x (#462)
Signed-off-by: ZouYuhua <zouy@vmware.com>
- Loading branch information
Showing
11 changed files
with
711 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,252 @@ | ||
#_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 | ||
d-i debian-installer/locale string en_US | ||
|
||
# Keyboard selection. | ||
d-i keyboard-configuration/xkb-keymap select us | ||
d-i keyboard-configuration/variant select English (US) | ||
|
||
### Network configuration | ||
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 | ||
|
||
# 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 | ||
|
||
# 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 pardus | ||
d-i netcfg/get_domain string unassigned-domain | ||
|
||
### 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. | ||
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' %} | ||
# 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 %} | ||
|
||
### 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 | ||
|
||
# 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 | ||
|
||
### 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/enable-source-repositories boolean true | ||
|
||
# Disable upgrading while installation | ||
d-i pkgsel/upgrade select none | ||
|
||
### Package selection | ||
#tasksel tasksel/first multiselect standard, web-server, kde-desktop | ||
tasksel tasksel/first multiselect standard, desktop | ||
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 | ||
|
||
# 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 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 | ||
|
||
# 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. | ||
# 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; \ | ||
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 ..." > /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; \ | ||
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);\ | ||
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; \ | ||
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" ];\ | ||
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; \ | ||
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; \ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.