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,44 @@
{
"name": "Tiny Core Linux",
"category": "guest",
"description": "Core Linux is a smaller variant of Tiny Core without a graphical desktop.\n\nIt's provide a complete Linux system in few MB.",
"vendor_name": "Team Tiny Core",
"vendor_url": "http://distro.ibiblio.org/tinycorelinux",
"documentation_url": "http://wiki.tinycorelinux.net/",
"product_name": "Tiny Core Linux",
"product_url": "http://distro.ibiblio.org/tinycorelinux",
"registry_version": 1,
"status": "stable",
"maintainer": "GNS3 Team",
"maintainer_email": "developers@gns3.net",
"usage": "Login is gns3/gns3. sudo works without password",
"symbol": "linux_guest.svg",
"qemu": {
"adapter_type": "e1000",
"adapters": 1,
"ram": 96,
"arch": "i386",
"console_type": "telnet"
},
"images": [
{
"filename": "linux-tinycore-6.4.qcow2",
"version": "6.4",
"md5sum": "bcd99ff8b3a9e7097455dcebe66ba2dd",
"filesize": 23855104,
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
"direct_download_url": "http://no.public.repository.yet/linux-tinycore-6.4.qcow2"
}
],
"versions": [
{
"name": "6.4",
"images": {
"hda_disk_image": "linux-tinycore-6.4.qcow2"
}
}
]
}

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

View File

@ -0,0 +1,48 @@
{
"builders":
[
{
"type": "qemu",
"iso_url": "http://distro.ibiblio.org/tinycorelinux/6.x/x86/release/Core-6.4.iso",
"iso_checksum": "c8e04e26de234e5528e6eac8ecb1bdda",
"iso_checksum_type": "md5",
"shutdown_command": "sudo poweroff",
"format": "qcow2",
"headless": false,
"ssh_username": "gns3",
"ssh_password": "gns3",
"accelerator": "none",
"vm_name": "tinycore-linux",
"disk_interface": "ide",
"net_device": "e1000",
"disk_size": 50,
"boot_wait": "10s",
"http_directory": "http",
"boot_command":
[
"mc user=gns3<enter><wait10><wait10><wait10>",
"sudo passwd gns3<enter>gns3<enter>gns3<enter>",
"tce-load -wi openssh<enter><wait10>",
"sudo /usr/local/etc/init.d/openssh start<enter>"
]
}
],
"provisioners": [
{
"type": "shell",
"script": "scripts/hd-install.sh"
},
{
"type": "shell",
"script": "scripts/serial.sh"
},
{
"type": "shell",
"script": "scripts/packages.sh"
},
{
"type": "shell",
"script": "scripts/post_setup.sh"
}
]
}