Я настраиваю автоматическую установку Ubuntu 14.04, используя preseed. Я тестировал это с помощью виртуальной машины (машины VirtualBox). Все устанавливает отлично, без каких-либо вопросов, но я не могу понять, как использовать команду late_command в конце файла preseed.
Что я хочу сделать в первый раз, это запустить запуск .
Я попытался несколько попыток:
Вот код:
d-i preseed/late_command string cp /cdrom/start.sh /target/home/user; in-target chmod 700 /home/user/start.sh; /home/user/start.sh
Также:
d-i preseed/late_command string chroot /target; cp -f /cdrom/start.sh /home/user; chmod 700 /home/user/start.sh;
Третья попытка:
d-i preseed/late_command string cp -f /cdrom/start.sh /home/user; in-target chmod +x /home/user/start.sh; in-target sh start.sh
сценарий start.sh определяет одну команду:
#! /bin/sh
echo "bonjour" > /home/user/bonjour_file
Я попытался также создать файл после установки на новом компьютере:
d-i preseed/late_command string in-target touch /etc/postinst_user.done
preseed preseed/late_command string in-target touch /etc/postinst_user.done
Но он просто висел в самом конце установки. Установка была работоспособной, но сценарий не запускался вообще, и файл «postinst_user.done» не был создан.
Является ли вновь установленная файловая система установленной под / целью? И что такое среда, как на данный момент в установке. Каким будет правильный способ сделать это?
Вот весь файл preseed с именем «ubuntu.seed»:
# Enable extras.ubuntu.com.
d-i apt-setup/extras boolean true
# Install the Ubuntu desktop.
tasksel tasksel/first multiselect ubuntu-desktop
# On live DVDs, don't spend huge amounts of time removing substantial
# application packages pulled in by language packs. Given that we clearly
# have the space to include them on the DVD, they're useful and we might as
# well keep them installed.
ubiquity ubiquity/keep-installed string icedtea6-plugin openoffice.org
d-i base-installer/kernel/altmeta string lts-xenial
####################################################################
# General
####################################################################
# Once installation is complete, automatically power off.
# d-i finish-install/reboot_in_progress note
#d-i debian-installer/exit/poweroff boolean true
#d-i ubiquity/summary note
#ubiquity ubiquity/reboot boolean true
#ubiquity ubiquity/poweroff boolean true
# Once installation is complete, automatically power off.
# d-i finish-install/reboot_in_progress note
#d-i debian-installer/exit/poweroff boolean true
#d-i ubiquity/summary note
#ubiquity ubiquity/reboot boolean true
#ubiquity ubiquity/poweroff boolean true
####################################################################
# Partitioning
####################################################################
# Configure auto partitioner
#ubiquity partman-auto/init_automatically_partition select Guided - use entire disk
#ubiquity partman-auto/disk string /dev/sda
#ubiquity partman-auto/method string regular
#ubiquity partman-auto/choose_recipe select All files in one partition (recommended for new users)
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman/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
####################################################################
# Locale
####################################################################
d-i debian-installer/locale string en_US
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string fr
# Optionally specify additional locales to be generated
d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8
###################################################################
# Localizations / Timezone
####################################################################
### Keyboard selection ###
d-i keyboard-configuration/layoutcode string fr
d-i keyboard-configuration/variantcode string
### Clock and Timezone ###
#see the contents of /usr/share/zoneinfo/ for valid values
d-i time/zone select Europe/Paris
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean false
####################################################################
# User Creation
####################################################################
d-i passwd/user-fullname string user
d-i passwd/username string user
d-i passwd/user-password password xxxxxx
d-i passwd/user-password-again password xxxxx
#d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video
#d-i passwd/root-login boolean true
#d-i passwd/root-password-crypted password hPdFxI2FOMtZk
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
#d-i passwd/auto-login boolean false
####################################################################
#Network Configuration
####################################################################
#d-i netcfg/enable boolean false
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/choose_interface select auto
###################################################################
# Installation Sources: Packages, Mirrors, Image
####################################################################
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu/
d-i apt-setup/use_mirror boolean true
d-i apt-setup/mirror/error select Change mirror
d-i apt-setup/multiverse boolean true
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/partner boolean true
####################################################################
# Grub
####################################################################
#d-i grub-installer/grub2_instead_of_grub_legacy boolean true
#d-i grub-installer/only_debian boolean true
#d-i finish-install/reboot_in_progress note
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
# finish installation
d-i finish-install/reboot_in_progress note
d-i finish-install/keep-consoles boolean false
d-i cdrom-detect/eject boolean true
d-i debian-installer/exit/halt boolean false
d-i debian-installer/exit/poweroff boolean false
####################################################################
# Customization
####################################################################
#first attempt
d-i preseed/late_command string cp /cdrom/start.sh /target/home/user; in-target chmod 700 /home/user/start.sh; /home/user/start.sh
#second attempt
d-i preseed/late_command string chroot /target; cp -f /cdrom/start.sh /home/user; chmod 700 /home/user/start.sh;
#Third attempt
d-i preseed/late_command string cp -f /cdrom/start.sh /home/user; in-target chmod +x /home/user/start.sh; in-target sh start.sh
#file creation
d-i preseed/late_command string in-target touch /etc/postinst_user.done
preseed preseed/late_command string in-target touch /etc/postinst_user.done
И я редактирую txt.cfg (в разделе isolinux), приведенный ниже. Я редактирую exaccty эту строку append file=/cdrom/preseed/ubuntu.seed keyboard configuration/layoutcode=fr boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet
default live
label live
menu label ^Try Ubuntu Automated version By Emila
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed keyboard
configuration/layoutcode=fr boot=casper automatic-ubiquity initrd=/casper/initrd.lz quiet
label live-install
menu label ^Install Ubuntu
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash ---
label check
menu label ^Check disc for defects
kernel /casper/vmlinuz
append boot=casper integrity-check initrd=/casper/initrd.lz quiet splash ---
label memtest
menu label Test ^memory
kernel /install/mt86plus
label hd
menu label ^Boot from first hard disk
localboot 0x80
Спасибо заранее,