2017-05-14 01:21:15 -04:00
|
|
|
#!/usr/bin/expect -f
|
|
|
|
|
|
|
|
log_file -noappend /tmp/expect.log
|
|
|
|
set force_conservative 0 ;# set to 1 to force conservative mode even if
|
|
|
|
;# script wasn't run conservatively originally
|
|
|
|
if {$force_conservative} {
|
|
|
|
set send_slow {1 .1}
|
|
|
|
proc send {ignore arg} {
|
|
|
|
sleep .1
|
|
|
|
exp_send -s -- $arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-14 12:07:39 -04:00
|
|
|
#set send_slow {10 .001}
|
2017-05-14 01:21:15 -04:00
|
|
|
|
|
|
|
set timeout -1
|
2017-05-15 02:47:04 -04:00
|
|
|
#spawn ./aif-config.py create -v:r -f /tmp/aif.xml
|
|
|
|
spawn ./aif-config.py create -v -f /tmp/aif.xml
|
2017-05-14 01:21:15 -04:00
|
|
|
## disks
|
|
|
|
send -- "/dev/sda,/dev/sdb\r"
|
|
|
|
# sda
|
|
|
|
send -- "gpt\r"
|
|
|
|
send -- "2\r"
|
|
|
|
# sda1
|
|
|
|
send -- "0%\r"
|
|
|
|
send -- "95%\r"
|
|
|
|
send -- "8300\r"
|
|
|
|
# sda2
|
|
|
|
send -- "95%\r"
|
|
|
|
send -- "100%\r"
|
|
|
|
send -- "ef00\r"
|
|
|
|
# sdb
|
|
|
|
send -- "gpt\r"
|
|
|
|
send -- "3\r"
|
|
|
|
# sdb1
|
|
|
|
send -- "0%\r"
|
|
|
|
send -- "47%\r"
|
|
|
|
send -- "8300\r"
|
|
|
|
# sdb2
|
|
|
|
send -- "47%\r"
|
|
|
|
send -- "95%\r"
|
|
|
|
send -- "8300\r"
|
|
|
|
# sdb3
|
|
|
|
send -- "95%\r"
|
|
|
|
send -- "100%\r"
|
|
|
|
send -- "8200\r"
|
|
|
|
## mounts
|
|
|
|
send -- "/mnt/aif,/mnt/aif/boot,/mnt/aif/home,/mnt/aif/mnt/data,swap\r"
|
|
|
|
# /mnt/aif
|
|
|
|
send -- "/dev/sda1\r"
|
|
|
|
send -- "1\r"
|
|
|
|
send -- "ext4\r"
|
|
|
|
send -- "defaults\r"
|
|
|
|
# /mnt/aif/boot
|
|
|
|
send -- "/dev/sda2\r"
|
|
|
|
send -- "2\r"
|
|
|
|
send -- "vfat\r"
|
|
|
|
send -- "rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro\r"
|
|
|
|
# /mnt/aif/home
|
|
|
|
send -- "/dev/sdb1\r"
|
|
|
|
send -- "3\r"
|
|
|
|
send -- "ext4\r"
|
|
|
|
send -- "defaults\r"
|
|
|
|
# /mnt/aif/mnt/data
|
|
|
|
send -- "/dev/sdb2\r"
|
|
|
|
send -- "4\r"
|
|
|
|
send -- "ext4\r"
|
|
|
|
send -- "defaults\r"
|
|
|
|
# swap
|
|
|
|
send -- "/dev/sdb3\r"
|
|
|
|
send -- "5\r"
|
|
|
|
## network
|
|
|
|
# hostname
|
|
|
|
send -- "aif.loc.lan\r"
|
|
|
|
# interface
|
|
|
|
send -- "ens3\r"
|
|
|
|
send -- "auto\r"
|
|
|
|
send -- "ipv4\r"
|
|
|
|
# add another interface?
|
|
|
|
send -- "y\r"
|
|
|
|
# second interface
|
|
|
|
send -- "ens4\r"
|
|
|
|
send -- "192.168.1.2/24\r"
|
|
|
|
send -- "192.168.1.1\r"
|
|
|
|
send -- "4.2.2.1,4.2.2.2\r"
|
|
|
|
# add another interface? default is no
|
|
|
|
send -- "\r"
|
|
|
|
## system
|
|
|
|
# timezone (default is UTC)
|
|
|
|
send -- "\r"
|
|
|
|
# locale (default is en_US.UTF-8
|
|
|
|
send -- "\r"
|
|
|
|
# chroot path
|
|
|
|
send -- "/mnt/aif\r"
|
|
|
|
# kbd (default is US)
|
|
|
|
send -- "\r"
|
|
|
|
# reboot host after install? default is yes
|
|
|
|
send -- "\r"
|
|
|
|
# root password
|
2017-05-14 12:07:39 -04:00
|
|
|
sleep 2
|
2017-05-14 01:21:15 -04:00
|
|
|
send -- "test\r"
|
2017-05-14 12:07:39 -04:00
|
|
|
sleep 2
|
|
|
|
expect *
|
2017-05-14 01:21:15 -04:00
|
|
|
# add user?
|
|
|
|
send -- "y\r"
|
|
|
|
# user
|
|
|
|
send -- "aifusr\r"
|
|
|
|
# sudo access
|
|
|
|
send -- "y\r"
|
|
|
|
# password
|
2017-05-14 12:07:39 -04:00
|
|
|
sleep 2
|
2017-05-14 01:21:15 -04:00
|
|
|
send -- "test\r"
|
2017-05-14 12:07:39 -04:00
|
|
|
sleep 2
|
2017-05-14 01:21:15 -04:00
|
|
|
send -- "A Test User\r"
|
|
|
|
# uid (default is autogen)
|
|
|
|
send -- "\r"
|
|
|
|
# primary group (default is autogen'd based on username)
|
|
|
|
send -- "\r"
|
|
|
|
# home dir (default is e.g. /home/username)
|
|
|
|
send -- "\r"
|
|
|
|
# add exta groups?
|
|
|
|
send -- "y\r"
|
|
|
|
# extra group
|
|
|
|
send -- "users\r"
|
|
|
|
# need to be created? default is no
|
|
|
|
send -- "\r"
|
|
|
|
# add another extra group? default is no
|
|
|
|
send -- "\r"
|
|
|
|
# add more users? default is no
|
|
|
|
send -- "\r"
|
|
|
|
# enable/disable services
|
|
|
|
send -- "y\r"
|
|
|
|
# service
|
|
|
|
send -- "sshd\r"
|
|
|
|
# enable? default is yes
|
|
|
|
send -- "\r"
|
|
|
|
# manage another service? default is no
|
|
|
|
send -- "\r"
|
|
|
|
# packager (default is pacman)
|
|
|
|
send -- "\r"
|
|
|
|
# review default repos? default is yes
|
|
|
|
send -- "\r"
|
|
|
|
# edit any of them?
|
|
|
|
send -- "y\r"
|
|
|
|
# edit the 6th repo (multilib)
|
|
|
|
send -- "6\r"
|
|
|
|
# enabled?
|
|
|
|
send -- "y\r"
|
|
|
|
# siglevel (default is unchanged)
|
|
|
|
send -- "\r"
|
|
|
|
# mirror URI (default is unchanged)
|
|
|
|
send -- "\r"
|
|
|
|
# edit another repo? default is no
|
|
|
|
send -- "\r"
|
|
|
|
# add additional repositories? default is no
|
|
|
|
send -- "\r"
|
2017-05-15 12:38:10 -04:00
|
|
|
# modify default mirrorlist?
|
|
|
|
send -- "y\r"
|
|
|
|
# URI for mirror
|
|
|
|
send -- "http://mirrors.advancedhosters.com/archlinux/\$repo/os/\$arch\r"
|
|
|
|
# add another?
|
|
|
|
send -- "y\r"
|
|
|
|
send -- "http://mirror.us.leaseweb.net/archlinux/\$repo/os/\$arch\r"
|
|
|
|
send -- "y\r"
|
|
|
|
send -- "http://arch.mirror.constant.com/\$repo/os/\$arch\r"
|
|
|
|
send -- "y\r"
|
|
|
|
send -- "http://mirror.vtti.vt.edu/archlinux/\$repo/os/\$arch\r"
|
|
|
|
send -- "y\r"
|
|
|
|
send -- "http://arch.mirrors.pair.com/\$repo/os/\$arch\r"
|
|
|
|
send -- "y\r"
|
|
|
|
send -- "http://mirror.yellowfiber.net/archlinux/\$repo/os/\$arch\r"
|
|
|
|
send -- "\r"
|
2017-05-14 01:21:15 -04:00
|
|
|
# install extra software?
|
|
|
|
send -- "y\r"
|
|
|
|
# software
|
|
|
|
send -- "openssh\r"
|
|
|
|
# repository (optional)
|
|
|
|
send -- "\r"
|
|
|
|
# add another package?
|
|
|
|
send -- "\r"
|
|
|
|
# bootloader (default is grub)
|
|
|
|
send -- "\r"
|
|
|
|
# system supports UEFI? default is yes
|
|
|
|
send -- "\r"
|
|
|
|
# ESP/EFI system partition
|
|
|
|
send -- "/boot\r"
|
|
|
|
# any hook scripts? default is no
|
2017-05-15 12:38:10 -04:00
|
|
|
send -- "y\r"
|
|
|
|
# pre, pkg, or post
|
|
|
|
send -- "post\r"
|
|
|
|
# script URI
|
|
|
|
send -- "https://aif.square-r00t.net/sample-scripts/post/first.sh\r"
|
|
|
|
# order for the execution run
|
|
|
|
send -- "1\r"
|
|
|
|
# auth required?
|
|
|
|
send -- "y\r"
|
|
|
|
# basic/digest? default is basic
|
|
|
|
send -- "digest\r"
|
|
|
|
# if digest, realm
|
|
|
|
send -- "realmname\r"
|
|
|
|
# user
|
|
|
|
send -- "test\r"
|
|
|
|
# password
|
|
|
|
send -- "password\r"
|
|
|
|
# would you like to add another script? default is no
|
2017-05-14 01:21:15 -04:00
|
|
|
send -- "\r"
|
2017-05-15 12:38:10 -04:00
|
|
|
interact
|
2017-05-14 01:21:15 -04:00
|
|
|
expect eof
|