Merge branch 'master' of https://github.com/void-linux/void-mklive
This commit is contained in:
commit
8b34d91818
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,9 @@
|
||||
*.iso
|
||||
*.raw
|
||||
*.tar.gz
|
||||
*.box
|
||||
xbps-cache
|
||||
xbps-cachedir*
|
||||
stamps*
|
||||
!dracut/*/*.sh
|
||||
!packer/scripts/*.sh
|
||||
|
17
Dockerfile
17
Dockerfile
@ -1,30 +1,31 @@
|
||||
# 1) use alpine to generate a void environment
|
||||
FROM alpine:3.9 as stage0
|
||||
ARG REPOSITORY=https://alpha.de.repo.voidlinux.org/current
|
||||
ARG REPOSITORY=https://alpha.de.repo.voidlinux.org
|
||||
ARG ARCH=x86_64
|
||||
COPY keys/* /target/var/db/xbps/keys/
|
||||
RUN apk add ca-certificates && \
|
||||
wget -O - https://alpha.de.repo.voidlinux.org/static/xbps-static-latest.$(uname -m)-musl.tar.xz | \
|
||||
wget -O - ${REPOSITORY}/static/xbps-static-latest.$(uname -m)-musl.tar.xz | \
|
||||
tar Jx && \
|
||||
XBPS_ARCH=${ARCH} xbps-install.static -yMU \
|
||||
--repository=${REPOSITORY} \
|
||||
--repository=${REPOSITORY}/musl \
|
||||
--repository=${REPOSITORY}/current \
|
||||
--repository=${REPOSITORY}/current/musl \
|
||||
-r /target \
|
||||
base-minimal
|
||||
|
||||
# 2) using void to generate the final build
|
||||
FROM scratch as stage1
|
||||
ARG REPOSITORY=https://alpha.de.repo.voidlinux.org/current
|
||||
ARG REPOSITORY=https://alpha.de.repo.voidlinux.org
|
||||
ARG ARCH=x86_64
|
||||
ARG BASEPKG=base-minimal
|
||||
COPY --from=stage0 /target /
|
||||
COPY keys/* /target/var/db/xbps/keys/
|
||||
RUN xbps-reconfigure -a && \
|
||||
mkdir -p /target/var/cache && ln -s /var/cache/xbps /target/var/cache/xbps && \
|
||||
XBPS_ARCH=${ARCH} xbps-install -yMU \
|
||||
--repository=${REPOSITORY} \
|
||||
--repository=${REPOSITORY}/musl \
|
||||
--repository=${REPOSITORY}/current \
|
||||
--repository=${REPOSITORY}/current/musl \
|
||||
-r /target \
|
||||
base-minimal
|
||||
${BASEPKG}
|
||||
|
||||
# 3) configure and clean up the final image
|
||||
FROM scratch
|
||||
|
52
Makefile
52
Makefile
@ -2,7 +2,7 @@ GITVER := $(shell git rev-parse --short HEAD)
|
||||
VERSION = 0.22
|
||||
SHIN += $(shell find -type f -name '*.sh.in')
|
||||
SCRIPTS += $(SHIN:.sh.in=.sh)
|
||||
DATE=$(shell date "+%Y%m%d")
|
||||
DATECODE=$(shell date "+%Y%m%d")
|
||||
SHELL=/bin/bash
|
||||
|
||||
T_PLATFORMS=rpi{,2,3}{,-musl} beaglebone{,-musl} cubieboard2{,-musl} odroid-c2{,-musl} usbarmory{,-musl} GCP{,-musl}
|
||||
@ -13,17 +13,21 @@ T_CLOUD_IMGS=GCP{,-musl}
|
||||
|
||||
T_PXE_ARCHS=x86_64{,-musl}
|
||||
|
||||
T_MASTERDIRS=x86_64{,-musl} i686
|
||||
|
||||
ARCHS=$(shell echo $(T_ARCHS))
|
||||
PLATFORMS=$(shell echo $(T_PLATFORMS))
|
||||
SBC_IMGS=$(shell echo $(T_SBC_IMGS))
|
||||
CLOUD_IMGS=$(shell echo $(T_CLOUD_IMGS))
|
||||
PXE_ARCHS=$(shell echo $(T_PXE_ARCHS))
|
||||
MASTERDIRS=$(shell echo $(T_MASTERDIRS))
|
||||
|
||||
ALL_ROOTFS=$(foreach arch,$(ARCHS),void-$(arch)-ROOTFS-$(DATE).tar.xz)
|
||||
ALL_PLATFORMFS=$(foreach platform,$(PLATFORMS),void-$(platform)-PLATFORMFS-$(DATE).tar.xz)
|
||||
ALL_SBC_IMAGES=$(foreach platform,$(SBC_IMGS),void-$(platform)-$(DATE).img.xz)
|
||||
ALL_CLOUD_IMAGES=$(foreach cloud,$(CLOUD_IMGS),void-$(cloud)-$(DATE).tar.gz)
|
||||
ALL_PXE_ARCHS=$(foreach arch,$(PXE_ARCHS),void-$(arch)-NETBOOT-$(DATE).tar.gz)
|
||||
ALL_ROOTFS=$(foreach arch,$(ARCHS),void-$(arch)-ROOTFS-$(DATECODE).tar.xz)
|
||||
ALL_PLATFORMFS=$(foreach platform,$(PLATFORMS),void-$(platform)-PLATFORMFS-$(DATECODE).tar.xz)
|
||||
ALL_SBC_IMAGES=$(foreach platform,$(SBC_IMGS),void-$(platform)-$(DATECODE).img.xz)
|
||||
ALL_CLOUD_IMAGES=$(foreach cloud,$(CLOUD_IMGS),void-$(cloud)-$(DATECODE).tar.gz)
|
||||
ALL_PXE_ARCHS=$(foreach arch,$(PXE_ARCHS),void-$(arch)-NETBOOT-$(DATECODE).tar.gz)
|
||||
ALL_MASTERDIRS=$(foreach arch,$(MASTERDIRS), masterdir-$(arch))
|
||||
|
||||
SUDO := sudo
|
||||
|
||||
@ -39,18 +43,18 @@ all: $(SCRIPTS)
|
||||
clean:
|
||||
rm -v *.sh
|
||||
|
||||
distdir-$(DATE):
|
||||
mkdir -p distdir-$(DATE)
|
||||
distdir-$(DATECODE):
|
||||
mkdir -p distdir-$(DATECODE)
|
||||
|
||||
dist: distdir-$(DATE)
|
||||
mv void*$(DATE)* distdir-$(DATE)/
|
||||
dist: distdir-$(DATECODE)
|
||||
mv void*$(DATECODE)* distdir-$(DATECODE)/
|
||||
|
||||
rootfs-all: $(ALL_ROOTFS)
|
||||
|
||||
rootfs-all-print:
|
||||
@echo $(ALL_ROOTFS) | sed "s: :\n:g"
|
||||
|
||||
void-%-ROOTFS-$(DATE).tar.xz: $(SCRIPTS)
|
||||
void-%-ROOTFS-$(DATECODE).tar.xz: $(SCRIPTS)
|
||||
$(SUDO) ./mkrootfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $*
|
||||
|
||||
platformfs-all: $(ALL_PLATFORMFS)
|
||||
@ -58,8 +62,8 @@ platformfs-all: $(ALL_PLATFORMFS)
|
||||
platformfs-all-print:
|
||||
@echo $(ALL_PLATFORMFS) | sed "s: :\n:g"
|
||||
|
||||
void-%-PLATFORMFS-$(DATE).tar.xz: $(SCRIPTS)
|
||||
$(SUDO) ./mkplatformfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $* void-$(shell ./lib.sh platform2arch $*)-ROOTFS-$(DATE).tar.xz
|
||||
void-%-PLATFORMFS-$(DATECODE).tar.xz: $(SCRIPTS)
|
||||
$(SUDO) ./mkplatformfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $* void-$(shell ./lib.sh platform2arch $*)-ROOTFS-$(DATECODE).tar.xz
|
||||
|
||||
images-all: platformfs-all images-all-sbc images-all-cloud
|
||||
|
||||
@ -70,20 +74,28 @@ images-all-cloud: $(ALL_CLOUD_IMAGES)
|
||||
images-all-print:
|
||||
@echo $(ALL_SBC_IMAGES) $(ALL_CLOUD_IMAGES) | sed "s: :\n:g"
|
||||
|
||||
void-%-$(DATE).img.xz: void-%-PLATFORMFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATE).tar.xz
|
||||
void-%-$(DATECODE).img.xz: void-%-PLATFORMFS-$(DATECODE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATECODE).tar.xz
|
||||
|
||||
# Some of the images MUST be compressed with gzip rather than xz, this
|
||||
# rule services those images.
|
||||
void-%-$(DATE).tar.gz: void-%-PLATFORMFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATE).tar.xz
|
||||
void-%-$(DATECODE).tar.gz: void-%-PLATFORMFS-$(DATECODE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATECODE).tar.xz
|
||||
|
||||
pxe-all: $(ALL_PXE_ARCHS)
|
||||
|
||||
pxe-all-print:
|
||||
@echo $(ALL_PXE_ARCHS) | sed "s: :\n:g"
|
||||
|
||||
void-%-NETBOOT-$(DATE).tar.gz: $(SCRIPTS) void-%-ROOTFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mknet.sh void-$*-ROOTFS-$(DATE).tar.xz
|
||||
void-%-NETBOOT-$(DATECODE).tar.gz: $(SCRIPTS) void-%-ROOTFS-$(DATECODE).tar.xz
|
||||
$(SUDO) ./mknet.sh void-$*-ROOTFS-$(DATECODE).tar.xz
|
||||
|
||||
.PHONY: clean dist rootfs-all-print platformfs-all-print pxe-all-print
|
||||
masterdir-all-print:
|
||||
@echo $(ALL_MASTERDIRS) | sed "s: :\n:g"
|
||||
|
||||
masterdir-all: $(ALL_MASTERDIRS)
|
||||
|
||||
masterdir-%:
|
||||
$(SUDO) docker build --build-arg REPOSITORY=$(XBPS_REPOSITORY) --build-arg ARCH=$* -t voidlinux/masterdir-$*:$(DATECODE) .
|
||||
|
||||
.PHONY: clean dist rootfs-all-print rootfs-all platformfs-all-print platformfs-all pxe-all-print pxe-all masterdir-all-print masterdir-all masterdir-push-all
|
||||
|
82
packer/http/autoinstall.cfg
Normal file
82
packer/http/autoinstall.cfg
Normal file
@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
# Void Linux Automatic Install Configuration
|
||||
|
||||
# ===
|
||||
# Disk Configuration
|
||||
# ===
|
||||
# disk: the disk to install to
|
||||
# default: the first disk that isn't the installer
|
||||
#disk=/dev/hda
|
||||
|
||||
# bootpartitionsize: controls how large the boot partition will be
|
||||
# default: 500M
|
||||
#bootpartitionsize=500M
|
||||
|
||||
# swapsize: how large should the swap partition be
|
||||
# default: equal to the installed physical memory
|
||||
#swapsize=
|
||||
|
||||
# ===
|
||||
# XBPS Configuration
|
||||
# ===
|
||||
# xbpsrepository: which repo should the install pull from
|
||||
# default: http://repo.voidlinux.eu/current
|
||||
|
||||
# pkgs: additional packages to install into the target
|
||||
# default: none
|
||||
#pkgs=""
|
||||
|
||||
# ===
|
||||
# Default User
|
||||
# ===
|
||||
# username: the username of the user to be created
|
||||
# default: voidlinux
|
||||
username="vagrant"
|
||||
|
||||
# password: password to set for the new user
|
||||
# default: unset (will prompt during install)
|
||||
# Warning: This does not work in musl!
|
||||
password="vagrant"
|
||||
|
||||
# ===
|
||||
# Misc. Options
|
||||
# ===
|
||||
# timezone: Timezone in TZ format
|
||||
# default: America/Chicago
|
||||
#timezone="America/Chicago"
|
||||
|
||||
# keymap: Keymap to use by default
|
||||
# default: us
|
||||
#keymap
|
||||
|
||||
# locale: initial glibc locale
|
||||
# default: en_US.UTF-8
|
||||
#libclocale=en.US.UTF-8
|
||||
|
||||
# hostname: static hostname for the system
|
||||
# default: derived from DNS
|
||||
#hostname=VoidLinux
|
||||
|
||||
# end_action: what to do at the end of the install
|
||||
# default: shutdown
|
||||
# alternate values: reboot, script
|
||||
end_action=func
|
||||
|
||||
# end_script: script to optionally run at end of install
|
||||
# the user script must reside somewhere xbps-uhelper fetch
|
||||
# can retrieve it from
|
||||
# default: not set
|
||||
|
||||
end_function() {
|
||||
printf "Linking default services"
|
||||
chroot ${target} ln -s /etc/sv/dhcpcd /etc/runit/runsvdir/default/dhcpcd
|
||||
chroot ${target} ln -s /etc/sv/sshd /etc/runit/runsvdir/default/sshd
|
||||
|
||||
xbps-install -r ${target} -Sy dbus virtualbox-ose-guest
|
||||
|
||||
chroot ${target} ln -s /etc/sv/dbus /etc/runit/runsvdir/default/dbus
|
||||
chroot ${target} ln -s /etc/sv/vboxservice /etc/runit/runsvdir/default/vboxservice
|
||||
|
||||
sync
|
||||
reboot -f
|
||||
}
|
21
packer/scripts/vagrant.sh
Normal file
21
packer/scripts/vagrant.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set up sudo
|
||||
echo '%vagrant ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/vagrant
|
||||
echo 'Defaults:vagrant !requiretty' >> /etc/sudoers.d/vagrant
|
||||
chmod 0440 /etc/sudoers.d/vagrant
|
||||
|
||||
gpasswd -d vagrant wheel
|
||||
|
||||
sudo xbps-install -Sy wget
|
||||
|
||||
# Installing vagrant keys
|
||||
mkdir /home/vagrant/.ssh
|
||||
chmod 700 /home/vagrant/.ssh
|
||||
cd /home/vagrant/.ssh
|
||||
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
|
||||
chmod 600 /home/vagrant/.ssh/authorized_keys
|
||||
chown -R vagrant /home/vagrant/.ssh
|
||||
|
||||
# Install NFS for Vagrant
|
||||
xbps-install -Sy nfs-utils
|
51
packer/templates/vagrant-glibc64.json
Normal file
51
packer/templates/vagrant-glibc64.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"variables": {
|
||||
"version": "{{env `RELEASE`}}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"type": "virtualbox-iso",
|
||||
"vboxmanage": [
|
||||
["modifyvm", "{{.Name}}", "--nictype1", "virtio"]
|
||||
],
|
||||
"iso_url": "https://alpha.de.repo.voidlinux.org/live/20190217/void-live-x86_64-20190217.iso",
|
||||
"iso_checksum": "b6884f6ea435e242c29a5778ced7a1ce187cef2f07eb9543765064a1256030e9",
|
||||
"iso_checksum_type": "sha256",
|
||||
"boot_wait": "5s",
|
||||
"boot_command": [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinstall.cfg",
|
||||
"<enter>"
|
||||
],
|
||||
"guest_os_type": "Linux_64",
|
||||
"http_directory": "http",
|
||||
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
|
||||
"ssh_wait_timeout": "20m",
|
||||
"virtualbox_version_file": ".vbox_version",
|
||||
"guest_additions_mode": "disable",
|
||||
"ssh_username": "vagrant",
|
||||
"ssh_password": "vagrant"
|
||||
}
|
||||
],
|
||||
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/vagrant.sh",
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
|
||||
}
|
||||
],
|
||||
|
||||
"post-processors": [
|
||||
[
|
||||
{
|
||||
"type": "vagrant"
|
||||
},
|
||||
{
|
||||
"type": "vagrant-cloud",
|
||||
"box_tag": "voidlinux/glibc64",
|
||||
"version": "{{user `version`}}"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user