mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-19 21:07:55 +00:00
move NETem packer files to tinycore-linux
This commit is contained in:
parent
a24cfae748
commit
30a7e86bd7
@ -23,19 +23,19 @@
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "NETem-v3.qcow2",
|
||||
"version": "0.3",
|
||||
"md5sum": "88297839b5f014ac15a434053f51690f",
|
||||
"filesize": 23461888,
|
||||
"download_url": "http://bernhard-ehlers.de/projects/netem/NETem-v3.qcow2",
|
||||
"direct_download_url": "http://bernhard-ehlers.de/projects/netem/NETem-v3.qcow2"
|
||||
"filename": "NETem-v4.qcow2",
|
||||
"version": "0.4",
|
||||
"md5sum": "e678698c97804901c7a53f6b68c8b861",
|
||||
"filesize": 26476544,
|
||||
"download_url": "http://bernhard-ehlers.de/projects/netem/index.html",
|
||||
"direct_download_url": "http://bernhard-ehlers.de/projects/netem/NETem-v4.qcow2"
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "0.3",
|
||||
"name": "0.4",
|
||||
"images": {
|
||||
"hda_disk_image": "NETem-v3.qcow2"
|
||||
"hda_disk_image": "NETem-v4.qcow2"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -1,60 +0,0 @@
|
||||
{
|
||||
"variables": {
|
||||
"tc_iso_url": "http://distro.ibiblio.org/tinycorelinux/6.x/x86/archive/6.4/Core-6.4.iso",
|
||||
"tc_iso_checksum": "c8e04e26de234e5528e6eac8ecb1bdda",
|
||||
"vm_name": "NETem.qcow2",
|
||||
"setup_script": "NETem.sh",
|
||||
"upload_dir": "uploads",
|
||||
"disk_size": "32"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"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": "{{user `vm_name`}}",
|
||||
"disk_interface": "ide",
|
||||
"disk_size": "{{user `disk_size`}}",
|
||||
"net_device": "e1000",
|
||||
"http_directory": "http",
|
||||
"boot_wait": "5s",
|
||||
"boot_command": [
|
||||
"mc user=gns3<enter><wait10><wait10><wait10><wait10><wait10><wait10>",
|
||||
"sudo passwd gns3<enter>gns3<enter>gns3<enter>",
|
||||
"tce-load -wi openssh<enter><wait10>",
|
||||
"cd /usr/local/etc/ssh; [ -f sshd_config.example ] && sudo cp -a sshd_config.example sshd_config; cd<enter>",
|
||||
"sudo /usr/local/etc/init.d/openssh start<enter>"
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/hd-install.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/serial.sh"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{user `upload_dir`}}/",
|
||||
"destination": "/tmp"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/{{user `setup_script`}}"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/post_setup.sh"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
# 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 1/' 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
|
||||
|
||||
# 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/*
|
||||
|
||||
# base system modifications
|
||||
sudo sed -i -e '/^\/opt\/bootlocal/ i' /opt/bootsync.sh
|
||||
echo -e "\nusername 'gns3', password 'gns3'\n" >> /etc/issue
|
||||
echo 'etc/issue' >> /opt/.filetool.lst
|
||||
echo 'etc/shadow' >> /opt/.filetool.lst
|
@ -1,9 +0,0 @@
|
||||
# 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
|
@ -1,21 +0,0 @@
|
||||
# Add serial console support
|
||||
|
||||
set -x
|
||||
|
||||
# Boot configuration
|
||||
# Serial interface is secondary console, the vga console remains main console
|
||||
# To change that, swap the two 'console=' boot parameter
|
||||
sudo sed -i -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/ a ttyS0::respawn:/sbin/getty 38400 ttyS0 xterm' /etc/inittab
|
||||
|
||||
# /etc/securetty
|
||||
sudo sed -i -e 's/^# *ttyS0/ttyS0/' /etc/securetty
|
||||
|
||||
# reload inittab on startup
|
||||
sudo sed -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
|
@ -1,26 +0,0 @@
|
||||
. /etc/init.d/tc-functions
|
||||
|
||||
# default LANG=C.UTF-8
|
||||
[ ! -f /etc/sysconfig/language ] || [ "`cat /etc/sysconfig/language`" = "LANG=C" ] && \
|
||||
echo "LANG=C.UTF-8" > /etc/sysconfig/language
|
||||
|
||||
# Configure network interfaces only when boot parameter "nodhcp" is used
|
||||
if grep -q -w nodhcp /proc/cmdline; then
|
||||
echo -en "${BLUE}Configuring network interfaces... ${NORMAL}"
|
||||
|
||||
# This waits until all devices have registered
|
||||
/sbin/udevadm settle --timeout=10
|
||||
|
||||
ip link add name br0 type bridge
|
||||
ip link set dev eth0 promisc on
|
||||
ip link set dev eth0 mtu 2000
|
||||
ip link set dev eth0 up
|
||||
ip link set dev eth0 master br0
|
||||
ip link set dev eth1 promisc on
|
||||
ip link set dev eth1 mtu 2000
|
||||
ip link set dev eth1 up
|
||||
ip link set dev eth1 master br0
|
||||
ip link set dev br0 up
|
||||
|
||||
echo -e "${GREEN}Done.${NORMAL}"
|
||||
fi
|
5
packer/tinycore-linux/NETem.json
Normal file
5
packer/tinycore-linux/NETem.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"vm_name": "NETem.qcow2",
|
||||
"setup_script": "NETem.sh",
|
||||
"disk_size": "32"
|
||||
}
|
@ -47,6 +47,16 @@ An appliance for simulating a domestic modem. eth0 as a dhcp and eth1 should be
|
||||
packer build -var-file=core-linux-internet.json core-linux.json
|
||||
|
||||
|
||||
NETem
|
||||
''''''
|
||||
|
||||
A build of Core with the NETem (Network link emulator) preinstalled.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
packer build -var-file=NETem.json core-linux.json
|
||||
|
||||
|
||||
|
||||
Tiny Core Linux installation
|
||||
****************************
|
||||
|
@ -25,7 +25,7 @@
|
||||
"http_directory": "http",
|
||||
"boot_wait": "5s",
|
||||
"boot_command": [
|
||||
"mc user=gns3<enter><wait10><wait10><wait10><wait10><wait10><wait10><wait10>",
|
||||
"mc user=gns3 http={{ .HTTPIP }}:{{ .HTTPPort }}<enter><wait10><wait10><wait10><wait10><wait10><wait10><wait10>",
|
||||
"sudo udhcpc<enter>",
|
||||
"sudo passwd gns3<enter>gns3<enter>gns3<enter>",
|
||||
"tce-load -wi openssh<enter><wait10>",
|
||||
|
@ -1,10 +1,6 @@
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# get TinyCore mirror
|
||||
. /etc/init.d/tc-functions
|
||||
getMirror
|
||||
|
||||
# TCE directory back to ramdisk
|
||||
mv /etc/sysconfig/tcedir /etc/sysconfig/tcedir.hd
|
||||
ln -s /tmp/tce /etc/sysconfig/tcedir
|
||||
@ -66,21 +62,14 @@ echo "net-bridging-$KERNEL.tcz" >> /etc/sysconfig/tcedir/onboot.lst
|
||||
tce-load -w net-sched-$KERNEL
|
||||
echo "net-sched-$KERNEL.tcz" >> /etc/sysconfig/tcedir/onboot.lst
|
||||
|
||||
# iproute2 without db library
|
||||
# Bug in TinyCore 6.x, which makes arpd non-working:
|
||||
# There is a mismatch of the library version between arpd and the db library.
|
||||
# Therefore loading the db library has no advantage, it uses only disk space.
|
||||
wget $MIRROR/iproute2.tcz
|
||||
wget $MIRROR/iproute2.tcz.md5.txt
|
||||
cp -p iproute2.tcz* /etc/sysconfig/tcedir/optional/
|
||||
echo 'iproute2.tcz' >> /etc/sysconfig/tcedir/onboot.lst
|
||||
|
||||
# clean up build environment
|
||||
cd ..
|
||||
rm -r build
|
||||
|
||||
# NETem menu system
|
||||
mv /tmp/netem-conf.py .
|
||||
. /etc/init.d/tc-functions
|
||||
http=http://`getbootparam http`
|
||||
wget $http/NETem/netem-conf.py
|
||||
chmod +x netem-conf.py
|
||||
|
||||
# autologin on serial console
|
||||
@ -103,10 +92,41 @@ EOF
|
||||
sudo sed -i -e '/label microcore/,/append / s/\(append .*\)/\1 nodhcp/' /mnt/sda1/boot/extlinux/extlinux.conf
|
||||
|
||||
# set locale and configure network at startup
|
||||
sed -i -e '3,$ d' /opt/bootlocal.sh
|
||||
sed -n -e '1,/^\/opt\/bootlocal/ p' /opt/bootsync.sh | head -n -1 > /tmp/bootsync.head
|
||||
sed -n -e '/^\/opt\/bootlocal/,$ p' /opt/bootsync.sh > /tmp/bootsync.tail
|
||||
cat /tmp/bootsync.head > /opt/bootsync.sh
|
||||
cat /tmp/boot_script >> /opt/bootsync.sh; echo >> /opt/bootsync.sh
|
||||
cat >> /opt/bootsync.sh <<'EOF'
|
||||
. /etc/init.d/tc-functions
|
||||
|
||||
# default LANG=C.UTF-8
|
||||
[ ! -f /etc/sysconfig/language ] || [ "`cat /etc/sysconfig/language`" = "LANG=C" ] && \
|
||||
echo "LANG=C.UTF-8" > /etc/sysconfig/language
|
||||
|
||||
# Configure network interfaces only when boot parameter "nodhcp" is used
|
||||
if grep -q -w nodhcp /proc/cmdline; then
|
||||
echo -en "${BLUE}Configuring network interfaces... ${NORMAL}"
|
||||
|
||||
# This waits until all devices have registered
|
||||
/sbin/udevadm settle --timeout=10
|
||||
|
||||
ip link add name br0 type bridge
|
||||
sysctl -q -w net.ipv6.conf.br0.disable_ipv6=1
|
||||
sysctl -q -w net.ipv6.conf.eth0.disable_ipv6=1
|
||||
ip link set dev eth0 promisc on
|
||||
ip link set dev eth0 mtu 2000
|
||||
ip link set dev eth0 up
|
||||
ip link set dev eth0 master br0
|
||||
sysctl -q -w net.ipv6.conf.eth1.disable_ipv6=1
|
||||
ip link set dev eth1 promisc on
|
||||
ip link set dev eth1 mtu 2000
|
||||
ip link set dev eth1 up
|
||||
ip link set dev eth1 master br0
|
||||
ip link set dev br0 up
|
||||
|
||||
echo -e "${GREEN}Done.${NORMAL}"
|
||||
fi
|
||||
EOF
|
||||
cat /tmp/bootsync.tail >> /opt/bootsync.sh
|
||||
|
||||
# Done
|
Loading…
Reference in New Issue
Block a user