Skip to content

Instantly share code, notes, and snippets.

@HirbodBehnam
Last active October 2, 2023 08:17
Show Gist options
  • Save HirbodBehnam/f0ba50a6e563c50c30804c77f8073075 to your computer and use it in GitHub Desktop.
Save HirbodBehnam/f0ba50a6e563c50c30804c77f8073075 to your computer and use it in GitHub Desktop.
Simple busybox init file
#!/bin/sh
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys
dmesg -n 1
echo "Welcome to CrowOS Live Linux (64-bit)!"
# Mount live CD to reallocate to it
echo "Mounting live volume..."
mkdir /livecd
mount UUID=6e422120-13ad-4a4d-b75e-02ab7757b3ae /livecd
if [[ $? != '0' ]]; then
echo "Cannot mount live partition. Dropping to memfs..."
exec /bin/sh
fi
# Re mount everything
echo "Remounting everything..."
mount -o move /dev /livecd/dev
mount -o move /proc /livecd/proc
mount -o move /sys /livecd/sys
# Network
echo "Setting up network..."
ifconfig lo 127.0.0.1
# Shell
echo "Dropping a shell and chrooting"
exec chroot /livecd setsid cttyhack /bin/sh
#!/bin/sh
# Mount system stuff
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys
# Networking https://serverfault.com/q/963994
ifconfig lo 127.0.0.1
# Shut up kernel logs
dmesg -n 1
echo "Welcome to my Linux!"
# Run shell with cttyhack to enable signals
exec setsid cttyhack /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment