Skip to content

Instantly share code, notes, and snippets.

@phieber
Last active May 21, 2022 02:26
Show Gist options
  • Save phieber/dde805548f611f5bf3dc1272726145f7 to your computer and use it in GitHub Desktop.
Save phieber/dde805548f611f5bf3dc1272726145f7 to your computer and use it in GitHub Desktop.
VPS notes for using takeover.sh
#!/bin/bash
# https://github.com/marcan/takeover.sh
#
# Allows to install another Linux flavor like e.g. Gentoo even if the VPS hoster doesn't offer/allow you to do so.
#
# First argument: the deep link to the sysresccd iso image
set -o nounset
/etc/init.d/apache2 stop
apt update
apt install -y git axel
cd /tmp
mkdir /takeover
mount -t tmpfs -o size=4096m tmpfs /takeover
# http://www.system-rescue-cd.org/Download
axel -n 20 -a -o systemresccd.iso $1
mkdir {/tmp/loopiso,/tmp/loopsfs}
mount -o loop systemresccd.iso /tmp/loopiso
mount -o loop /tmp/loopiso/sysrcd.dat /tmp/loopsfs
git clone https://github.com/marcan/takeover.sh.git /takeover
cp -rp /tmp/loopsfs/* /takeover/
umount {/tmp/loopsfs,/tmp/loopiso}
wget -O /takeover/busybox https://www.busybox.net/downloads/binaries/1.26.2-defconfig-multiarch/busybox-x86_64
chmod +x /takeover/busybox
cd /takeover
chroot /takeover gcc /fakeinit.c -o /fakeinit
sh /takeover/takeover.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment