TinyCore Linux appliance + packer

This commit is contained in:
Bernhard Ehlers
2015-10-06 14:50:43 +02:00
parent d704aaa6df
commit 5e9f0fcc1d
6 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,37 @@
# Install tinycore on harddisk
set -x
# format harddisk
echo -e 'n\np\n1\n\n\na\n1\nw' | sudo fdisk -H16 -S32 /dev/sda
sudo mkfs.ext2 /dev/sda1
# copy system to harddisk
sudo mkdir /mnt/sda1
sudo mount /dev/sda1 /mnt/sda1
sudo mount /mnt/sr0
sudo cp -a /mnt/sr0/boot /mnt/sda1/
sudo umount /mnt/sr0
# modify bootloader config
sudo mv /mnt/sda1/boot/isolinux /mnt/sda1/boot/extlinux
cd /mnt/sda1/boot/extlinux
sudo rm boot.cat isolinux.bin
sudo mv isolinux.cfg extlinux.conf
sudo sed -i -e '/append / s/$/ user=gns3/' -e 's/timeout .*/timeout 30/' extlinux.conf
cd
# make disk bootable
tce-load -wi syslinux
sudo sh -c 'cat /usr/local/share/syslinux/mbr.bin > /dev/sda'
sudo /usr/local/sbin/extlinux --install /mnt/sda1/boot/extlinux
# create extensions directory
sudo mkdir /mnt/sda1/tce
sudo chgrp staff /mnt/sda1/tce
sudo chmod 775 /mnt/sda1/tce
# base system modifications
echo 'etc/issue' >> /opt/.filetool.lst
echo 'etc/shadow' >> /opt/.filetool.lst
echo -e "\nusername 'gns3', password 'gns3'\n" >> /etc/issue

View File

@ -0,0 +1,18 @@
# Add extensions
set -x
# change tcedir to harddisk
mv /etc/sysconfig/tcedir /etc/sysconfig/tcedir.bak
ln -s /mnt/sda1/tce /etc/sysconfig/tcedir
rm -rf /usr/local/tce.installed/*
# openssh (optional)
tce-load -wi openssh
echo '/usr/local/etc/init.d/openssh start' >> /opt/bootlocal.sh
echo 'usr/local/etc/ssh' >> /opt/.filetool.lst
tce-load -wi ipv6-`uname -r` iptables iproute2
tce-load -wi tcpdump
tce-load -wi iperf3

View File

@ -0,0 +1,9 @@
# post-installation script
set -x
# save changes
rm -f .ash_history
filetool.sh -b sda1
# write 0, not really necessary
#sudo dd if=/dev/zero of=/mnt/sda1/zero ; sudo rm -f /mnt/sda1/zero

View File

@ -0,0 +1,21 @@
# Add serial console support
set -x
# Boot configuration
# Serial interface is secondary console, the vga console remains main console
# To change that, exchange the two 'console=' boot parameter
sudo sed -i -e '1i serial 0 38400' -e '/append loglevel/ s/$/ console=ttyS0,38400 console=tty0/' /mnt/sda1/boot/extlinux/extlinux.conf
# /etc/inittab
sudo sed -i -e '/tty6/attyS0::respawn:/sbin/getty 38400 ttyS0 xterm' /etc/inittab
# /etc/securetty
sudo sed -i -e 's/^# *ttyS0/ttyS0/' /etc/securetty
# reload initab on startup
sudo sed -i -e '/^\/opt\/bootlocal/ i' -e '/^\/opt\/bootlocal/ i# reload inittab' -e '/^\/opt\/bootlocal/ i kill -HUP 1' -e '/^\/opt\/bootlocal/ i' /opt/bootsync.sh
# add modified files to backup list
echo 'etc/inittab' >> /opt/.filetool.lst
echo 'etc/securetty' >> /opt/.filetool.lst