diff --git a/build.json b/build.json index 9689eb1..1dbe763 100644 --- a/build.json +++ b/build.json @@ -1,33 +1,24 @@ { "variables": { - "memory": "4G", - "cpus": "2", + "iso_url": "http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/alpine-standard-3.9.3-x86_64.iso", + "iso_checksum": "6e28c5c902ccb6db24596dfb6a1c255c7989d0b9be4e92e87a8eff523201a459", + "iso_checksum_type": "sha256", - "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.8.0-amd64-netinst.iso", - "iso_checksum": "cc4a6bd50925c1c4af98049060e304494bc9da61eb5eb272c556d67608de14d4e6a4b8bc1c9412a0f810083912e228569f3771ffffa7174538f3e26f45a05245", - "iso_checksum_type": "sha512", - - "boot_wait": "3s", + "boot_wait": "10s", "boot_key_interval": "10ms", - "ssh_username": "unifi", - "ssh_password": "uuunifi", + "root_password": "uuunifi", "ssh_timeout": "60m", - "machine_hostname": "unifi-controller", - "machine_domain": "lab.uncomfortably.online", + "machine_hostname": "unifi", - "http_directory": "http/", - "preseed_file": "preseed.cfg" + "http_directory": "http/" }, "builders": [ { "type": "qemu", "accelerator": "kvm", - "qemuargs": [ - [ "-m", "{{ user `memory` }}" ], - [ "-smp", "cpus={{ user `cpus`}}"] - ], + "disk_interface": "virtio", "iso_url": "{{user `iso_url`}}", "iso_checksum": "{{user `iso_checksum`}}", @@ -38,26 +29,36 @@ "boot_wait": "{{user `boot_wait`}}", "boot_key_interval": "{{user `boot_key_interval`}}", "boot_command": [ - "", - "install ", - "auto=true ", - "url=http://{{.HTTPIP}}:{{.HTTPPort}}/{{user `preseed_file`}} ", + "root", + + "ifconfig eth0 up && ", + "udhcpc -i eth0", + "", + + "wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/answers", + "sed -i ", + "-e \"s/:hostname:/{{user `machine_hostname`}}/g\" ", + "answers", + + "sed -i \"s/rc-service \\$svc start/#&/\" /sbin/setup-sshd", - "hostname={{user `machine_hostname`}} ", - "domain={{user `machine_domain`}} ", - "interface=auto ", + "setup-alpine -f answers && ", + "mount /dev/vda3 /mnt && ", + "echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config && ", + "umount /mnt && ", + "reboot", + "", + "", - "passwd/user-fullname={{user `ssh_username`}} ", - "passwd/username={{user `ssh_username`}} ", - "passwd/user-password={{user `ssh_password`}} ", - "passwd/user-password-again={{user `ssh_password`}} ", + "{{user `root_password`}}", + "{{user `root_password`}}", - "" + "y" ], "communicator": "ssh", - "ssh_username": "{{user `ssh_username`}}", - "ssh_password": "{{user `ssh_password`}}", + "ssh_username": "root", + "ssh_password": "{{user `root_password`}}", "ssh_timeout": "{{user `ssh_timeout`}}" } ] diff --git a/http/answers b/http/answers new file mode 100644 index 0000000..7b9f9af --- /dev/null +++ b/http/answers @@ -0,0 +1,19 @@ +KEYMAPOPTS="us us" + +HOSTNAMEOPTS="-n :hostname:" +INTERFACESOPTS="auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet dhcp + hostname :hostname:" + +DNSOPTS="-d 8.8.8.8" +TIMEZONEOPTS="-z UTC" +PROXYOPTS="none" + +APKREPOSOPTS="-1" +SSHDOPTS="-c openssh" +NTPOPTS="-c chrony" + +DISKOPTS="-m sys /dev/vda" \ No newline at end of file diff --git a/http/preseed.cfg b/http/preseed.cfg deleted file mode 100644 index 7a1e306..0000000 --- a/http/preseed.cfg +++ /dev/null @@ -1,62 +0,0 @@ -### Localization -# Preseeding only locale sets language, country and locale. -d-i debian-installer/locale string en_US - -# Keyboard selection. -d-i keyboard-configuration/xkb-keymap select 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 - -# Disable that annoying WEP key dialog. -d-i netcfg/wireless_wep string - -### Mirror settings -d-i mirror/country string manual -d-i mirror/http/hostname string http.us.debian.org -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -### Account setup -# Skip creation of a root account (normal user account will be able to -# use sudo). -d-i passwd/root-login boolean false - -## Package setup -d-i hw-detect/load_firmware boolean false -d-i hw-detect/load_media boolean false -apt-cdrom-setup apt-setup/cdrom/set-first boolean false -tasksel tasksel/first multiselect print-server, ssh-server, standard -d-i pkgsel/include string sudo, unattended-upgrades -popularity-contest popularity-contest/participate boolean false - -### Clock and time zone setup -d-i clock-setup/utc boolean true -d-i time/zone string UTC -d-i clock-setup/ntp boolean true - -### Partitioning -d-i partman-auto/method string lvm -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-auto/choose_recipe select atomic -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 - -# 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 - -### Boot loader installation -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true -d-i finish-install/reboot_in_progress note