Skip to content

Instantly share code, notes, and snippets.

@Bystroushaak
Created October 5, 2011 14:14
Show Gist options
  • Save Bystroushaak/1264529 to your computer and use it in GitHub Desktop.
Save Bystroushaak/1264529 to your computer and use it in GitHub Desktop.
#! /usr/bin/env sh
# Router postinstalation script by Bystroushaak (bystrousak@kitakitsune.org)
cd /
SWAP_SIZE=`free | grep -i swap | tr -s [:space:] " " | cut -d " " -f 2`
if [ $SWAP_SIZE -eq 0 ]; then
echo "Creating swap file .."
dd if=/dev/zero of=/swapfile bs=1024 count=98304;
mkswap /swapfile;
swapon /swapfile;
echo >> /etc/fstab
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
echo "Swapfile created"
fi
echo "Setting up networking..
"
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
EOF
echo "nameserver 192.168.1.1" >> /etc/resolf.conf
echo "Done"
echo "Check /etc/network/interfaces and /etc/resolf.conf"
echo >> ~/.bashrc
echo "alias la='ls -laFh'" >> ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment