Cleaning and tweaking (missing one-context?) of arch ONE script
This commit is contained in:
parent
71ecdae421
commit
5a0dbe8f82
1 changed files with 22 additions and 18 deletions
|
@ -9,14 +9,12 @@ set -e
|
|||
set -x
|
||||
|
||||
# XXX: Handle command-line arguments?
|
||||
ARCH=amd64
|
||||
IMAGE_PATH=arch-$(date --iso-8601).img.qcow2
|
||||
IMAGE_SIZE=10G
|
||||
NBD_DEVICE=/dev/nbd0
|
||||
|
||||
# TODO: find the package definition and built ourself, publish in some RPM repository.
|
||||
ONE_CONTEXT_DEB_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v5.10.0/one-context_5.10.0-1.deb"
|
||||
ONE_CONTEXT_DEB_PATH=/root/one-context.deb
|
||||
ONE_CONTEXT_VERSION=5.12.0.2
|
||||
ONE_CONTEXT_SOURCE_ARCHIVE="https://github.com/OpenNebula/addon-context-linux/archive/v$ONE_CONTEXT_VERSION.tar.gz"
|
||||
|
||||
cleanup() {
|
||||
# The order here is important.
|
||||
|
@ -42,9 +40,9 @@ if [ "$(whoami)" != 'root' ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(lsb_release --short --id) != "Arch" ]; then
|
||||
echo "WARNING: this script has been designed to run on an Ubuntu system." >&2
|
||||
echo "WARNING: Not running Ubuntu. Giving you 5 seconds to abort." >&2
|
||||
if [ "$(lsb_release --short --id)" != "Arch" ]; then
|
||||
echo "WARNING: this script has been designed to run on Arch Linux." >&2
|
||||
echo "WARNING: Not running Arch. Giving you 5 seconds to abort." >&2
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
|
@ -75,7 +73,7 @@ mkdir /mnt/boot
|
|||
mount "${NBD_DEVICE}p1" /mnt/boot
|
||||
|
||||
# Install base system.
|
||||
pacstrap /mnt nbase base-devel openssh
|
||||
pacstrap /mnt base base-devel openssh
|
||||
|
||||
mount --bind /dev /mnt/dev
|
||||
mount --bind /dev/pts /mnt/dev/pts
|
||||
|
@ -84,9 +82,6 @@ mount --bind /proc /mnt/proc
|
|||
mount --bind /run /mnt/run
|
||||
mount --bind /sys /mnt/sys
|
||||
|
||||
# Guest networking is to be handled by the one-context package.
|
||||
# See https://github.com/OpenNebula/addon-context-linux for details.
|
||||
|
||||
# Required to resolve package mirror in chroot.
|
||||
cp /etc/resolv.conf /mnt/etc/resolv.conf
|
||||
|
||||
|
@ -105,16 +100,25 @@ cat > /mnt/etc/pacman.d/mirrorlist << EOF
|
|||
##
|
||||
|
||||
## Switzerland
|
||||
Server = http://pkg.adfinis-sygroup.ch/archlinux/$repo/os/$arch
|
||||
Server = https://pkg.adfinis-sygroup.ch/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.init7.net/archlinux/$repo/os/$arch
|
||||
Server = https://mirror.init7.net/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.puzzle.ch/archlinux/$repo/os/$arch
|
||||
Server = https://mirror.puzzle.ch/archlinux/$repo/os/$arch
|
||||
Server = https://mirror.ungleich.ch/mirror/packages/archlinux/$repo/os/$arch
|
||||
Server = http://pkg.adfinis-sygroup.ch/archlinux/\$repo/os/\$arch
|
||||
Server = https://pkg.adfinis-sygroup.ch/archlinux/\$repo/os/\$arch
|
||||
Server = http://mirror.init7.net/archlinux/\$repo/os/\$arch
|
||||
Server = https://mirror.init7.net/archlinux/\$repo/os/\$arch
|
||||
Server = http://mirror.puzzle.ch/archlinux/\$repo/os/\$arch
|
||||
Server = https://mirror.puzzle.ch/archlinux/\$repo/os/\$arch
|
||||
Server = https://mirror.ungleich.ch/mirror/packages/archlinux/\$repo/os/\$arch
|
||||
EOF
|
||||
run_root pacman --sync --refresh --upgrade
|
||||
|
||||
# Guest networking is to be handled by the one-context package.
|
||||
# See https://github.com/OpenNebula/addon-context-linux for details.
|
||||
run_root pacman --sync curl tar
|
||||
run_root curl -L "$ONE_CONTEXT_SOURCE_ARCHIVE" -o one-context.tar.gz
|
||||
run_root tar xf one-context.tar.gz
|
||||
run_root cp -rT addon-context-linux-${ONE_CONTEXT_VERSION}/src/ /
|
||||
run_root rm -r addon-context-linux-${ONE_CONTEXT_VERSION}
|
||||
run_root systemctl enable one-context.service
|
||||
|
||||
# Initalize base services.
|
||||
run_root systemd-machine-id-setup
|
||||
|
||||
|
|
Loading…
Reference in a new issue