diff --git a/appliances/tinycore-linux.gns3a b/appliances/tinycore-linux.gns3a index 2538acb..758ddc0 100644 --- a/appliances/tinycore-linux.gns3a +++ b/appliances/tinycore-linux.gns3a @@ -26,10 +26,18 @@ { "filename": "linux-tinycore-6.4.qcow2", "version": "6.4", - "md5sum": "bcd99ff8b3a9e7097455dcebe66ba2dd", - "filesize": 23855104, + "md5sum": "786a1c2f2e9db61d0580ed58a37da5dd", + "filesize": 23920640, "download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/", "direct_download_url": "http://no.public.repository.yet/linux-tinycore-6.4.qcow2" + }, + { + "filename": "linux-tinycore-4.7.7.qcow2", + "version": "4.7.7", + "md5sum": "bb4559be28875500bba2a32d3f75f6d4", + "filesize": 26804224, + "download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/", + "direct_download_url": "http://no.public.repository.yet/linux-tinycore-4.7.7.qcow2" } ], @@ -39,6 +47,12 @@ "images": { "hda_disk_image": "linux-tinycore-6.4.qcow2" } + }, + { + "name": "4.7.7", + "images": { + "hda_disk_image": "linux-tinycore-4.7.7.qcow2" + } } ] } diff --git a/packer/tinycore-linux/README.rst b/packer/tinycore-linux/README.rst new file mode 100644 index 0000000..06a284d --- /dev/null +++ b/packer/tinycore-linux/README.rst @@ -0,0 +1,15 @@ +Packer for TinyCore GNS3 appliance +================================== + +For building a TinyCore V6.4 appliance run: + +.. code:: bash + + packer build -var-file=tc-6.4.json tinycore-linux.json + + +Likewise, to build a TinyCore V4.7.7 appliance run: + +.. code:: bash + + packer build -var-file=tc-4.7.7.json tinycore-linux.json diff --git a/packer/tinycore-linux/scripts/hd-install.sh b/packer/tinycore-linux/scripts/hd-install.sh index ff82010..0f570af 100644 --- a/packer/tinycore-linux/scripts/hd-install.sh +++ b/packer/tinycore-linux/scripts/hd-install.sh @@ -32,6 +32,6 @@ sudo chgrp staff /mnt/sda1/tce sudo chmod 775 /mnt/sda1/tce # base system modifications +echo -e "\nusername 'gns3', password 'gns3'\n" >> /etc/issue echo 'etc/issue' >> /opt/.filetool.lst echo 'etc/shadow' >> /opt/.filetool.lst -echo -e "\nusername 'gns3', password 'gns3'\n" >> /etc/issue diff --git a/packer/tinycore-linux/scripts/packages.sh b/packer/tinycore-linux/scripts/packages.sh index 9150e2b..ffcfb9f 100644 --- a/packer/tinycore-linux/scripts/packages.sh +++ b/packer/tinycore-linux/scripts/packages.sh @@ -9,8 +9,10 @@ rm -rf /usr/local/tce.installed/* # openssh (optional) tce-load -wi openssh -echo '/usr/local/etc/init.d/openssh start' >> /opt/bootlocal.sh +[ -f /usr/local/etc/ssh/ssh_config.example ] && sudo cp -a /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config +[ -f /usr/local/etc/ssh/sshd_config.example ] && sudo cp -a /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config echo 'usr/local/etc/ssh' >> /opt/.filetool.lst +echo '/usr/local/etc/init.d/openssh start' >> /opt/bootlocal.sh tce-load -wi ipv6-`uname -r` iptables iproute2 tce-load -wi tcpdump diff --git a/packer/tinycore-linux/scripts/serial.sh b/packer/tinycore-linux/scripts/serial.sh index fbda42b..5c65d34 100644 --- a/packer/tinycore-linux/scripts/serial.sh +++ b/packer/tinycore-linux/scripts/serial.sh @@ -5,16 +5,16 @@ 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 +sudo sed -i -r -e '1 i serial 0 38400' -e '/label microcore/,/append / s/(append .*)/\1 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 +sudo sed -i -e '/tty6/ a ttyS0::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 +# reload inittab 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 diff --git a/packer/tinycore-linux/tc-4.7.7.json b/packer/tinycore-linux/tc-4.7.7.json new file mode 100644 index 0000000..365d2ea --- /dev/null +++ b/packer/tinycore-linux/tc-4.7.7.json @@ -0,0 +1,4 @@ +{ + "tc_iso_url": "http://distro.ibiblio.org/tinycorelinux/4.x/x86/archive/4.7.7/Core-4.7.7.iso", + "tc_iso_checksum": "f610b20a97801c937ffb791443a32640" +} diff --git a/packer/tinycore-linux/tc-6.4.json b/packer/tinycore-linux/tc-6.4.json new file mode 100644 index 0000000..1ed8d09 --- /dev/null +++ b/packer/tinycore-linux/tc-6.4.json @@ -0,0 +1,4 @@ +{ + "tc_iso_url": "http://distro.ibiblio.org/tinycorelinux/6.x/x86/release/Core-6.4.iso", + "tc_iso_checksum": "c8e04e26de234e5528e6eac8ecb1bdda" +} diff --git a/packer/tinycore-linux/tinycore-linux.json b/packer/tinycore-linux/tinycore-linux.json index 758cba4..b5e3be2 100644 --- a/packer/tinycore-linux/tinycore-linux.json +++ b/packer/tinycore-linux/tinycore-linux.json @@ -1,28 +1,31 @@ { - "builders": - [ + "variables": { + "tc_iso_url": null, + "tc_iso_checksum": null + }, + "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": - [ + "type": "qemu", + "iso_url": "{{user `tc_iso_url`}}", + "iso_checksum": "{{user `tc_iso_checksum`}}", + "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", + "disk_size": 50, + "net_device": "e1000", + "http_directory": "http", + "boot_wait": "10s", + "boot_command": [ "mc user=gns3", "sudo passwd gns3gns3gns3", "tce-load -wi openssh", + "cd /usr/local/etc/ssh; [ -f sshd_config.example ] && sudo cp -a sshd_config.example sshd_config; cd", "sudo /usr/local/etc/init.d/openssh start" ] }