-
-
Save Lokawn/52bf52fa78a0aec017cd3dcefb9df41f to your computer and use it in GitHub Desktop.
Revisions
-
sfan5 revised this gist
Jul 26, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.20} APKTOOLS_VERSION=2.14.4-r0 -
sfan5 revised this gist
May 11, 2024 . 3 changed files with 13 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.19} APKTOOLS_VERSION=2.14.4-r0 wget_or_curl () { This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 --numeric-owner # configure mirror printf 'Server = %s/$repo/os/$arch\n' "$MIRROR" >"$dest"/etc/pacman.d/mirrorlist sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this # https://github.com/systemd/systemd/issues/852 This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash -e # Creates a systemd-nspawn container with Ubuntu CODENAME=${CODENAME:-noble} wget_or_curl () { if command -v wget >/dev/null; then @@ -50,12 +50,17 @@ rm "$dest/etc/resolv.conf" # systemd configures this # https://github.com/systemd/systemd/issues/852 [ -f "$dest/etc/securetty" ] && \ printf 'pts/%d\n' $(seq 0 10) >>"$dest/etc/securetty" # container needs no mounts >"$dest/etc/fstab" # disable services and uninstall packages systemd-nspawn -q -D "$dest" sh -c ' [ -s /etc/environment ] && . /etc/environment for unit in ssh.service ssh.socket systemd-timesyncd systemd-networkd-wait-online systemd-resolved; do systemctl is-enabled "$unit" && systemctl disable "$unit" done apt-get -qq satisfy -y --purge "Conflicts: lxcfs, lxd, snapd, cloud-init" || \ apt-get -qq purge --autoremove snapd lxcfs lxd cloud-init ' echo "" -
sfan5 revised this gist
Apr 8, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ $apkdir/sbin/apk.static \ mkdir -p "$dest"/{etc/apk,root} # configure mirror printf '%s/%s/main\n%s/%s/community\n' "$MIRROR" $VERSION "$MIRROR" $VERSION >"$dest"/etc/apk/repositories for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" done -
sfan5 revised this gist
Apr 5, 2024 . 3 changed files with 88 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,36 +3,62 @@ MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.19} APKTOOLS_VERSION=2.14.3-r1 wget_or_curl () { if command -v wget >/dev/null; then wget -qO- "$1" elif command -v curl >/dev/null; then curl -Ls "$1" else echo "missing either curl or wget" >&2 return 1 fi } if [ $UID -ne 0 ]; then echo "run this script as root" >&2 exit 1 fi dest="$1" if [ -z "$dest" ]; then echo "Usage: $0 <destination>" >&2 exit 0 fi if [ -e "$dest/usr/bin" ]; then echo "destination already seems to contain a root file system" >&2 exit 1 fi if [[ "$(uname -m)" =~ ^i[3456]86|x86 ]]; then toolarch=x86 guestarch=$toolarch [ "$(uname -m)" = x86_64 ] && guestarch=x86_64 elif [[ "$(uname -m)" =~ ^arm|aarch64 ]]; then toolarch=armv7 guestarch=$toolarch [ "$(uname -m)" = aarch64 ] && guestarch=aarch64 else echo "unsupported architecture" >&2 exit 1 fi apkdir=$(mktemp -d) trap 'rm -rf $apkdir' EXIT wget_or_curl "$MIRROR/latest-stable/main/$toolarch/apk-tools-static-$APKTOOLS_VERSION.apk" \ | tar -xz -C $apkdir || \ { echo "couldn't download apk-tools, the version might have changed..." >&2; exit 1; } $apkdir/sbin/apk.static \ -X $MIRROR/$VERSION/main -U --arch $guestarch \ --allow-untrusted --root "$dest" \ --initdb add alpine-base mkdir -p "$dest"/{etc/apk,root} # configure mirror printf '%s/%s/main\n%s/%s/community\n' $MIRROR $VERSION >"$dest"/etc/apk/repositories for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" done @@ -49,4 +75,4 @@ done echo "" echo "Alpine $VERSION $guestarch container was created successfully." This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,38 +6,56 @@ ISO_DATE=latest PKG_GROUPS="base" wget_or_curl () { if command -v wget >/dev/null; then wget "$1" -O "$2" elif command -v curl >/dev/null; then curl -L "$1" -o "$2" else echo "missing either curl or wget" >&2 return 1 fi } if [ $UID -ne 0 ]; then echo "run this script as root" >&2 exit 1 fi dest="$1" if [ -z "$dest" ]; then echo "Usage: $0 <destination>" >&2 exit 0 fi if [ -e "$dest/usr/bin" ]; then echo "destination already seems to contain a root file system" >&2 exit 1 fi [ "$(uname -m)" = x86_64 ] || { echo "unsupported architecture" >&2; exit 1; } tarfile=$(mktemp) trap 'rm $tarfile' EXIT wget_or_curl "$MIRROR/iso/$ISO_DATE/archlinux-bootstrap-x86_64.tar.gz" $tarfile mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 --numeric-owner # configure mirror printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this # https://github.com/systemd/systemd/issues/852 [ -f "$dest/etc/securetty" ] && \ printf 'pts/%d\n' $(seq 0 10) >>"$dest/etc/securetty" # seems to be this bug https://github.com/systemd/systemd/issues/3611 systemd-machine-id-setup --root="$dest" # install the packages systemd-nspawn -q -D "$dest" sh -c " pacman-key --init && pacman-key --populate pacman -Sy --noconfirm --needed ${PKG_GROUPS} " echo "" echo "Arch Linux container was created successfully (bootstrapped from $ISO_DATE)" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,22 +3,44 @@ CODENAME=${CODENAME:-jammy} wget_or_curl () { if command -v wget >/dev/null; then wget "$1" -O "$2" elif command -v curl >/dev/null; then curl -L "$1" -o "$2" else echo "missing either curl or wget" >&2 return 1 fi } if [ $UID -ne 0 ]; then echo "run this script as root" >&2 exit 1 fi dest="$1" if [ -z "$dest" ]; then echo "Usage: $0 <destination>" >&2 exit 0 fi if [ -e "$dest/usr/bin" ]; then echo "destination already seems to contain a root file system" >&2 exit 1 fi if [ "$(uname -m)" = x86_64 ]; then guestarch=amd64 elif [ "$(uname -m)" = aarch64 ]; then guestarch=arm64 else echo "unsupported architecture" >&2 exit 1 fi rootfs=$(mktemp) trap 'rm $rootfs' EXIT wget_or_curl "http://cloud-images.ubuntu.com/${CODENAME}/current/${CODENAME}-server-cloudimg-${guestarch}-root.tar.xz" $rootfs mkdir -p "$dest" tar -xaf $rootfs -C "$dest" --numeric-owner @@ -37,4 +59,4 @@ systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq satisfy -y --purge 'Conflicts: echo "" echo "Ubuntu $CODENAME $guestarch container was created successfully" -
sfan5 revised this gist
Feb 25, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.19} APKTOOLS_VERSION=2.14.0-r5 if [ $UID -ne 0 ]; then -
sfan5 revised this gist
Oct 20, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=latest PKG_GROUPS="base" @@ -20,7 +20,7 @@ dest="$1" tarfile=$(mktemp) trap 'rm $tarfile' EXIT wget "$MIRROR/iso/$ISO_DATE/archlinux-bootstrap-x86_64.tar.gz" -O $tarfile mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 --numeric-owner -
sfan5 revised this gist
Jul 8, 2023 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.18} APKTOOLS_VERSION=2.14.0-r2 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2023.07.01 PKG_GROUPS="base" -
sfan5 revised this gist
Dec 5, 2022 . 3 changed files with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.17} APKTOOLS_VERSION=2.12.10-r1 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2022.12.01 PKG_GROUPS="base" @@ -23,7 +23,7 @@ trap 'rm $tarfile' EXIT wget "$MIRROR/iso/$ISO_DATE/archlinux-bootstrap-$ISO_DATE-x86_64.tar.gz" -O $tarfile mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 --numeric-owner printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login @@ -32,7 +32,7 @@ rm "$dest/etc/resolv.conf" # systemd configures this [ -f "$dest/etc/securetty" ] && \ printf 'pts/%d\n' $(seq 0 10) >>"$dest/etc/securetty" cat >"$dest"/setup.sh <<SCRIPT pacman-key --init && pacman-key --populate pacman -Sy --noconfirm --needed ${PKG_GROUPS} rm /setup.sh SCRIPT This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ trap 'rm $rootfs' EXIT wget "http://cloud-images.ubuntu.com/${CODENAME}/current/${CODENAME}-server-cloudimg-amd64-root.tar.xz" -O $rootfs mkdir -p "$dest" tar -xaf $rootfs -C "$dest" --numeric-owner sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this @@ -32,8 +32,8 @@ rm "$dest/etc/resolv.conf" # systemd configures this systemd-nspawn -q -D "$dest" /bin/systemctl disable \ ssh systemd-{timesyncd,networkd-wait-online,resolved} # uninstall some packages systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq satisfy -y --purge 'Conflicts: lxcfs, lxd, snapd, cloud-init' || \ systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq purge --autoremove snapd lxcfs lxd cloud-init echo "" -
sfan5 revised this gist
Nov 4, 2022 . 3 changed files with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,11 +20,11 @@ dest="$1" apkdir=$(mktemp -d) guestarch=x86 [ "$(uname -m)" == x86_64 ] && guestarch=x86_64 trap 'rm -r $apkdir' EXIT wget -qO- $MIRROR/latest-stable/main/x86/apk-tools-static-$APKTOOLS_VERSION.apk \ | tar -xz -C $apkdir || \ { echo "Couldn't download apk-tools, the version might have changed..."; exit 1; } $apkdir/sbin/apk.static \ -X $MIRROR/$VERSION/main -U --arch $guestarch \ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2022.11.01 PKG_GROUPS="base" @@ -18,19 +18,19 @@ fi dest="$1" tarfile=$(mktemp) trap 'rm $tarfile' EXIT wget "$MIRROR/iso/$ISO_DATE/archlinux-bootstrap-$ISO_DATE-x86_64.tar.gz" -O $tarfile mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this # https://github.com/systemd/systemd/issues/852 [ -f "$dest/etc/securetty" ] && \ printf 'pts/%d\n' $(seq 0 10) >>"$dest/etc/securetty" cat >"$dest"/setup.sh <<SCRIPT pacman-key --init && pacman-key --populate archlinux pacman -Sy --noconfirm --needed ${PKG_GROUPS} This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,9 +16,9 @@ fi dest="$1" rootfs=$(mktemp) trap 'rm $rootfs' EXIT wget "http://cloud-images.ubuntu.com/${CODENAME}/current/${CODENAME}-server-cloudimg-amd64-root.tar.xz" -O $rootfs mkdir -p "$dest" tar -xaf $rootfs -C "$dest" -
sfan5 revised this gist
Jul 7, 2022 . 3 changed files with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.16} APKTOOLS_VERSION=2.12.9-r3 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2022.07.01 PKG_GROUPS="base" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash -e # Creates a systemd-nspawn container with Ubuntu CODENAME=${CODENAME:-jammy} if [ $UID -ne 0 ]; then @@ -30,7 +30,7 @@ rm "$dest/etc/resolv.conf" # systemd configures this printf 'pts/%d\n' $(seq 0 10) >>"$dest/etc/securetty" >"$dest/etc/fstab" systemd-nspawn -q -D "$dest" /bin/systemctl disable \ ssh systemd-{timesyncd,networkd-wait-online,resolved} # uninstall some packages systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq satisfy -y --purge 'Conflicts: lxcfs, lxd, snapd' || \ systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq purge --autoremove snapd lxcfs lxd -
sfan5 revised this gist
Apr 19, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2022.04.05 PKG_GROUPS="base" -
sfan5 revised this gist
Jan 19, 2022 . 3 changed files with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.15} APKTOOLS_VERSION=2.12.7-r3 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2022.01.01 PKG_GROUPS="base" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ rm "$dest/etc/resolv.conf" # systemd configures this >"$dest/etc/fstab" systemd-nspawn -q -D "$dest" /bin/systemctl disable \ ssh systemd-{timesyncd,networkd-wait-online,resolved} # uninstall some packages systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq satisfy -y --purge 'Conflicts: lxcfs, lxd, snapd' || \ systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq purge --autoremove snapd lxcfs lxd -
sfan5 revised this gist
Aug 11, 2021 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.14} APKTOOLS_VERSION=2.12.7-r0 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2021.08.01 PKG_GROUPS="base" -
sfan5 revised this gist
Jun 28, 2021 . 3 changed files with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.13} APKTOOLS_VERSION=2.12.5-r1 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2021.06.01 PKG_GROUPS="base" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,10 +25,10 @@ tar -xaf $rootfs -C "$dest" sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this # https://github.com/systemd/systemd/issues/852 [ -f "$dest/etc/securetty" ] && \ printf 'pts/%d\n' $(seq 0 10) >>"$dest/etc/securetty" >"$dest/etc/fstab" systemd-nspawn -q -D "$dest" /bin/systemctl disable \ ssh systemd-{timesyncd,networkd-wait-online,resolved} # packages that are useless inside container -
sfan5 revised this gist
May 24, 2021 . 2 changed files with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.13} APKTOOLS_VERSION=2.12.5-r0 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2021.05.01 PKG_GROUPS="base" @@ -26,6 +26,7 @@ mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" -
sfan5 revised this gist
Feb 13, 2021 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.13} APKTOOLS_VERSION=2.12.1-r0 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2021.02.01 PKG_GROUPS="base" -
sfan5 revised this gist
Nov 19, 2020 . 2 changed files with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2020.11.01 PKG_GROUPS="base" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,8 @@ echo >"$dest/etc/fstab" systemd-nspawn -q -D "$dest" /bin/systemctl disable \ ssh systemd-{timesyncd,networkd-wait-online,resolved} # packages that are useless inside container systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq satisfy -y --purge 'Conflicts: lxcfs, lxd, snapd' || \ systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq purge --autoremove snapd lxcfs lxd echo "" -
sfan5 revised this gist
Sep 10, 2020 . 3 changed files with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash -e # Creates a systemd-nspawn container with Alpine MIRROR=http://dl-cdn.alpinelinux.org/alpine VERSION=${VERSION:-v3.12} APKTOOLS_VERSION=2.10.5-r1 This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2020.09.01 PKG_GROUPS="base" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,9 +30,9 @@ for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 done echo >"$dest/etc/fstab" systemd-nspawn -q -D "$dest" /bin/systemctl disable \ ssh systemd-{timesyncd,networkd-wait-online,resolved} # packages that are useless inside container systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq satisfy -y --purge 'Conflicts: lxcfs, lxd, snapd' echo "" -
sfan5 revised this gist
Jul 5, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,8 +28,9 @@ rm "$dest/etc/resolv.conf" # systemd configures this for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" done echo >"$dest/etc/fstab" systemd-nspawn -q -D "$dest" /bin/systemctl disable \ rsync ssh systemd-{timesyncd,networkd-wait-online,resolved} # useless inside container systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq --autoremove purge -y snapd lxd -
sfan5 revised this gist
Jun 10, 2020 . 3 changed files with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://nl.alpinelinux.org/alpine VERSION=${VERSION:-v3.12} APKTOOLS_VERSION=2.10.5-r1 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2020.06.01 PKG_GROUPS="base" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash -e # Creates a systemd-nspawn container with Ubuntu CODENAME=${CODENAME:-focal} if [ $UID -ne 0 ]; then @@ -31,7 +31,7 @@ done systemd-nspawn -q -D "$dest" /bin/systemctl disable \ rsync ssh systemd-{timesyncd,networkd,resolved} # useless inside container systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq --autoremove purge -y snapd lxd echo "" -
sfan5 revised this gist
Mar 6, 2020 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,6 @@ # Creates a systemd-nspawn container with Alpine MIRROR=http://nl.alpinelinux.org/alpine VERSION=v3.11 APKTOOLS_VERSION=2.10.4-r3 -
sfan5 revised this gist
Jan 10, 2020 . 3 changed files with 30 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,8 @@ MIRROR=http://nl.alpinelinux.org/alpine ARCH=x86_64 VERSION=v3.11 APKTOOLS_VERSION=2.10.4-r3 if [ $UID -ne 0 ]; then @@ -25,6 +25,7 @@ guestarch=x86 wget -qO- $MIRROR/latest-stable/main/x86/apk-tools-static-$APKTOOLS_VERSION.apk \ | tar -xz -C $apkdir || \ { echo "Couldn't download apk-tools, the version might have changed..."; exit 1; } trap 'rm -r $apkdir' EXIT $apkdir/sbin/apk.static \ -X $MIRROR/$VERSION/main -U --arch $guestarch \ @@ -33,8 +34,13 @@ $apkdir/sbin/apk.static \ mkdir -p "$dest"/{etc/apk,root} printf '%s/%s/main\n' $MIRROR $VERSION >"$dest"/etc/apk/repositories for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" done # make console work sed '/tty[0-9]:/ s/^/#/' -i "$dest"/etc/inittab printf 'console::respawn:/sbin/getty 38400 console\n' >>"$dest"/etc/inittab # minimal boot services for s in hostname bootmisc syslog; do ln -s /etc/init.d/$s "$dest"/etc/runlevels/boot/$s done @@ -43,6 +49,5 @@ for s in killprocs savecache; do done echo "" echo "Alpine $VERSION container was created successfully." This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2020.01.01 PKG_GROUPS="base" @@ -19,21 +19,24 @@ fi dest="$1" tarfile=$(mktemp) wget "$MIRROR/iso/$ISO_DATE/archlinux-bootstrap-$ISO_DATE-x86_64.tar.gz" -O $tarfile trap 'rm $tarfile' EXIT mkdir -p "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist rm "$dest/etc/resolv.conf" # systemd configures this for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" done cat >"$dest"/setup.sh <<SCRIPT pacman-key --init && pacman-key --populate archlinux pacman -Sy --noconfirm --needed ${PKG_GROUPS} rm /setup.sh SCRIPT systemd-nspawn -q -D "$dest" sh /setup.sh echo "" echo "Arch Linux container was created successfully (bootstrapped from $ISO_DATE)" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,20 +18,21 @@ dest="$1" rootfs=$(mktemp) wget "http://cloud-images.ubuntu.com/${CODENAME}/current/${CODENAME}-server-cloudimg-amd64-root.tar.xz" -O $rootfs trap 'rm $rootfs' EXIT mkdir -p "$dest" tar -xaf $rootfs -C "$dest" sed '/^root:/ s|\*||' -i "$dest/etc/shadow" # passwordless login rm "$dest/etc/resolv.conf" # systemd configures this for i in $(seq 0 10); do # https://github.com/systemd/systemd/issues/852 echo "pts/$i" >>"$dest/etc/securetty" done systemd-nspawn -q -D "$dest" /bin/systemctl disable \ rsync ssh systemd-{timesyncd,networkd,resolved} # useless inside container systemd-nspawn -q -D "$dest" /usr/bin/apt-get -qq --autoremove purge -y snapd lxcfs lxd echo "" echo "Ubuntu $CODENAME container was created successfully" -
sfan5 revised this gist
Nov 17, 2019 . 1 changed file with 4 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2019.11.01 PKG_GROUPS="base" @@ -23,19 +23,17 @@ wget $MIRROR/iso/$ISO_DATE/archlinux-bootstrap-$ISO_DATE-x86_64.tar.gz -O $tarfi mkdir "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist cat >"$dest"/setup.sh <<SCRIPT pacman-key --init pacman-key --populate archlinux pacman -Sy --noconfirm --needed ${PKG_GROUPS} rm /setup.sh SCRIPT systemd-nspawn -q -D "$dest" sh /setup.sh rm "$dest"/etc/resolv.conf "$dest"/etc/securetty rm $tarfile echo "" echo "Arch Linux container was created successfully. (bootstrapped from $ISO_DATE)" -
sfan5 revised this gist
Sep 25, 2019 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ #!/bin/bash -e # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.fra10.de.leaseweb.net/archlinux ISO_DATE=2019.09.01 PKG_GROUPS="base" @@ -25,16 +25,17 @@ tar -xzf $tarfile -C "$dest" --strip-components=1 rm "$dest"/etc/resolv.conf "$dest"/etc/securetty printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist cat >"$dest"/setup.sh <<SCRIPT pacman-key --init pacman-key --populate archlinux pacman -Sy # avoid installing the kernel pacman -Sg ${PKG_GROUPS} | while read _ p;do [[ "\$p" == "linux"* ]]||echo "\$p";done | pacman -S --noconfirm --needed - rm /setup.sh SCRIPT systemd-nspawn -q -D "$dest" sh /setup.sh rm $tarfile echo "" echo "Arch $ISO_DATE container was created successfully." -
sfan5 revised this gist
Aug 13, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ #!/bin/bash -e # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirrors.n-ix.net/archlinux ISO_DATE=2019.08.01 PKG_GROUPS="base" -
sfan5 revised this gist
Jul 23, 2019 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,8 @@ MIRROR=http://nl.alpinelinux.org/alpine ARCH=x86_64 VERSION=v3.10 APKTOOLS_VERSION=2.10.4-r2 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.rackspace.com/archlinux ISO_DATE=2019.07.01 PKG_GROUPS="base" -
sfan5 revised this gist
May 24, 2019 . 1 changed file with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.rackspace.com/archlinux ISO_DATE=2019.05.02 PKG_GROUPS="base" if [ $UID -ne 0 ]; then @@ -25,17 +25,16 @@ tar -xzf $tarfile -C "$dest" --strip-components=1 rm "$dest"/etc/resolv.conf "$dest"/etc/securetty printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist systemd-nspawn -q -D "$dest" --pipe sh <<SCRIPT pacman-key --init pacman-key --populate archlinux pacman -Sy # avoid installing the kernel pacman -Sg ${PKG_GROUPS} | while read _ p;do [[ "\$p" == "linux"* ]]||echo "\$p";done | pacman -S --noconfirm --needed - SCRIPT rm $tarfile echo "" echo "Arch $ISO_DATE container was created successfully." -
sfan5 revised this gist
Feb 11, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ wget $MIRROR/iso/$ISO_DATE/archlinux-bootstrap-$ISO_DATE-x86_64.tar.gz -O $tarfi mkdir "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 rm "$dest"/etc/resolv.conf "$dest"/etc/securetty printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist systemd-nspawn -q -D "$dest" sh <<SCRIPT pacman-key --init -
sfan5 revised this gist
Feb 11, 2019 . 2 changed files with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,8 @@ MIRROR=http://nl.alpinelinux.org/alpine ARCH=x86_64 VERSION=v3.9 APKTOOLS_VERSION=2.10.3-r1 if [ $UID -ne 0 ]; then This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # Creates a systemd-nspawn container with Arch Linux MIRROR=http://mirror.rackspace.com/archlinux ISO_DATE=2019.02.01 PACKAGES="base" @@ -23,6 +23,7 @@ wget $MIRROR/iso/$ISO_DATE/archlinux-bootstrap-$ISO_DATE-x86_64.tar.gz -O $tarfi mkdir "$dest" tar -xzf $tarfile -C "$dest" --strip-components=1 rm "$dest"/etc/resolv.conf printf 'Server = %s/$repo/os/$arch\n' $MIRROR >"$dest"/etc/pacman.d/mirrorlist systemd-nspawn -q -D "$dest" sh <<SCRIPT pacman-key --init -
sfan5 revised this gist
Dec 16, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ MIRROR=http://nl.alpinelinux.org/alpine ARCH=x86_64 VERSION=v3.8 APKTOOLS_VERSION=2.10.1-r0 if [ $UID -ne 0 ]; then
NewerOlder