mirror of
https://github.com/GNS3/gns3-registry.git
synced 2025-01-31 00:24:52 +00:00
Update alpine packer, add GUI
This commit is contained in:
parent
ac384b014a
commit
1d6f4634a1
2
packer/alpine-linux/.gitignore
vendored
Normal file
2
packer/alpine-linux/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
output-qemu
|
||||||
|
packer_cache
|
28
packer/alpine-linux/README.rst
Normal file
28
packer/alpine-linux/README.rst
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Packer for Alpine GNS3 appliance
|
||||||
|
================================
|
||||||
|
|
||||||
|
For building an Alpine appliance.
|
||||||
|
|
||||||
|
https://alpinelinux.org/
|
||||||
|
|
||||||
|
CLI Linux installation
|
||||||
|
**********************
|
||||||
|
|
||||||
|
The only added packages are:
|
||||||
|
* busybox-extras
|
||||||
|
* nano
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
packer build alpine_cli.json
|
||||||
|
|
||||||
|
|
||||||
|
GUI Linux installation
|
||||||
|
**********************
|
||||||
|
|
||||||
|
The GUI version has XFCE4 installed.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
packer build alpine_gui.json
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"builders":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"type": "qemu",
|
|
||||||
"iso_url": "http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.2/releases/x86_64/alpine-mini-3.2.3-x86_64.iso",
|
|
||||||
"iso_checksum": "a718c78537a0d416fa0b7cfcef1dfb85d1e837aa",
|
|
||||||
"iso_checksum_type": "sha1",
|
|
||||||
"shutdown_command": "poweroff",
|
|
||||||
"format": "qcow2",
|
|
||||||
"headless": false,
|
|
||||||
"ssh_username": "root",
|
|
||||||
"ssh_password": "gns3",
|
|
||||||
"vm_name": "alpine-linux",
|
|
||||||
"accelerator": "none",
|
|
||||||
"disk_interface": "ide",
|
|
||||||
"net_device": "e1000",
|
|
||||||
"disk_size": 5000,
|
|
||||||
"boot_wait": "120s",
|
|
||||||
"http_directory": "http",
|
|
||||||
"ssh_wait_timeout": "60m",
|
|
||||||
"boot_command":
|
|
||||||
[
|
|
||||||
"root<enter><wait>",
|
|
||||||
"echo \"root:gns3\" | chpasswd<enter>",
|
|
||||||
"ifconfig eth0 up && udhcpc -i eth0<enter><wait5>",
|
|
||||||
"setup-apkrepos -r<enter><wait5>",
|
|
||||||
"setup-sshd -c openssh<enter>"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"provisioners": [
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"script": "scripts/setup.sh"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"inline": [ "reboot" ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"pause_before": "60s",
|
|
||||||
"script": "scripts/post_setup.sh"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
68
packer/alpine-linux/alpine_cli.json
Normal file
68
packer/alpine-linux/alpine_cli.json
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"iso_url": "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso",
|
||||||
|
"iso_checksum": "fe694a34c0e2d30b9e5dea7e2c1a3892c1f14cb474b69cc5c557a52970071da5",
|
||||||
|
"vm_name": "alpine_cli.qcow2",
|
||||||
|
"setup_script": "setup.sh",
|
||||||
|
"disk_size": "500"
|
||||||
|
},
|
||||||
|
"builders": [
|
||||||
|
{
|
||||||
|
"type": "qemu",
|
||||||
|
"iso_url": "{{user `iso_url`}}",
|
||||||
|
"iso_checksum": "{{user `iso_checksum`}}",
|
||||||
|
"iso_checksum_type": "sha256",
|
||||||
|
"shutdown_command": "poweroff",
|
||||||
|
"headless": true,
|
||||||
|
"ssh_username": "root",
|
||||||
|
"ssh_password": "root",
|
||||||
|
"vm_name": "{{user `vm_name`}}",
|
||||||
|
"disk_interface": "ide",
|
||||||
|
"disk_compression": true,
|
||||||
|
"net_device": "e1000",
|
||||||
|
"disk_size": "{{user `disk_size`}}",
|
||||||
|
"boot_wait": "20s",
|
||||||
|
"ssh_wait_timeout": "60s",
|
||||||
|
"boot_command": [
|
||||||
|
"root<enter><wait>",
|
||||||
|
"echo 'root:root' | chpasswd<enter>",
|
||||||
|
"ifconfig lo up<enter>",
|
||||||
|
"ifconfig eth0 up && udhcpc -i eth0<enter><wait10>",
|
||||||
|
"setup-sshd -c openssh<enter><wait>",
|
||||||
|
"sed -i.orig '$aPermitRootLogin yes' /etc/ssh/sshd_config<enter>",
|
||||||
|
"service sshd restart<enter><wait>"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"provisioners": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/install.sh"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"inline": [
|
||||||
|
"reboot"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"pause_before": "20s",
|
||||||
|
"inline": [
|
||||||
|
"apk upgrade --update-cache"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/serial.sh"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/{{user `setup_script`}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/post_setup.sh"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
68
packer/alpine-linux/alpine_gui.json
Normal file
68
packer/alpine-linux/alpine_gui.json
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"iso_url": "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso",
|
||||||
|
"iso_checksum": "fe694a34c0e2d30b9e5dea7e2c1a3892c1f14cb474b69cc5c557a52970071da5",
|
||||||
|
"vm_name": "alpine_gui.qcow2",
|
||||||
|
"setup_script": "setup.sh",
|
||||||
|
"disk_size": "1000"
|
||||||
|
},
|
||||||
|
"builders": [
|
||||||
|
{
|
||||||
|
"type": "qemu",
|
||||||
|
"iso_url": "{{user `iso_url`}}",
|
||||||
|
"iso_checksum": "{{user `iso_checksum`}}",
|
||||||
|
"iso_checksum_type": "sha256",
|
||||||
|
"shutdown_command": "poweroff",
|
||||||
|
"headless": true,
|
||||||
|
"ssh_username": "root",
|
||||||
|
"ssh_password": "root",
|
||||||
|
"vm_name": "{{user `vm_name`}}",
|
||||||
|
"disk_interface": "ide",
|
||||||
|
"disk_compression": true,
|
||||||
|
"net_device": "e1000",
|
||||||
|
"disk_size": "{{user `disk_size`}}",
|
||||||
|
"boot_wait": "20s",
|
||||||
|
"ssh_wait_timeout": "60s",
|
||||||
|
"boot_command": [
|
||||||
|
"root<enter><wait>",
|
||||||
|
"echo 'root:root' | chpasswd<enter>",
|
||||||
|
"ifconfig lo up<enter>",
|
||||||
|
"ifconfig eth0 up && udhcpc -i eth0<enter><wait10>",
|
||||||
|
"setup-sshd -c openssh<enter><wait>",
|
||||||
|
"sed -i.orig '$aPermitRootLogin yes' /etc/ssh/sshd_config<enter>",
|
||||||
|
"service sshd restart<enter><wait>"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"provisioners": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/install.sh"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"inline": [
|
||||||
|
"reboot"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"pause_before": "20s",
|
||||||
|
"inline": [
|
||||||
|
"apk upgrade --update-cache"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/gui.sh"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/{{user `setup_script`}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"script": "scripts/post_setup.sh"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
packer/alpine-linux/scripts/gui.sh
Normal file
17
packer/alpine-linux/scripts/gui.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# add community repository
|
||||||
|
sed -i 's/^#\(.*\/v.*\/community\)$/\1/' /etc/apk/repositories
|
||||||
|
apk update
|
||||||
|
|
||||||
|
# install packages
|
||||||
|
setup-xorg-base lxdm xfwm4 xfdesktop xfce4-appfinder xfce4-session xfce4-settings xfce4-terminal dillo thunar exo adwaita-icon-theme ttf-dejavu xf86-video-qxl
|
||||||
|
|
||||||
|
# configure packages
|
||||||
|
sed -i 's/^.*session=.*/session=\/usr\/bin\/startxfce4/' /etc/lxdm/lxdm.conf
|
||||||
|
echo "/sbin/poweroff" >> /etc/lxdm/PreShutdown
|
||||||
|
ln -s /usr/bin/dillo /usr/local/bin/firefox
|
||||||
|
rc-update add dbus
|
||||||
|
rc-update add lxdm
|
||||||
|
|
||||||
|
# create user account
|
||||||
|
adduser -D -g "Linux User" user
|
||||||
|
passwd -u user
|
28
packer/alpine-linux/scripts/install.sh
Normal file
28
packer/alpine-linux/scripts/install.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export HOSTNAMEOPTS="-n alpine"
|
||||||
|
export KEYMAPOPTS="us us"
|
||||||
|
export INTERFACESOPTS="auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
auto eth0
|
||||||
|
iface eth0 inet dhcp
|
||||||
|
"
|
||||||
|
export TIMEZONEOPTS="-z UTC"
|
||||||
|
export PROXYOPTS="none"
|
||||||
|
export APKREPOSOPTS="-1"
|
||||||
|
export SSHDOPTS="-c openssh"
|
||||||
|
export NTPOPTS="-c none"
|
||||||
|
export BOOT_SIZE=50
|
||||||
|
export SWAP_SIZE=0
|
||||||
|
|
||||||
|
# Answer to password question twice and yes to format drive
|
||||||
|
setup-alpine <<EOF
|
||||||
|
root
|
||||||
|
root
|
||||||
|
sda
|
||||||
|
sys
|
||||||
|
y
|
||||||
|
EOF
|
@ -1,10 +1,8 @@
|
|||||||
#Enable a terminal on serial port
|
# restore default sshd configuration
|
||||||
echo "ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt1003" >> etc/inittab
|
mv /etc/ssh/sshd_config.orig /etc/ssh/sshd_config
|
||||||
|
|
||||||
apk add linux-virtgrsec
|
# clear cache
|
||||||
apk del linux-grsec
|
|
||||||
rm -Rf /lib/firmware
|
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# Write 0
|
# Write 0
|
||||||
dd if=/dev/zero of=/zero ; rm -f /zero
|
dd if=/dev/zero bs=1M of=/zero ; rm -f /zero
|
||||||
|
5
packer/alpine-linux/scripts/serial.sh
Normal file
5
packer/alpine-linux/scripts/serial.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# use serial console
|
||||||
|
sed -i 's/\(APPEND .*\)/\1 console=ttyS0/' /boot/extlinux.conf
|
||||||
|
|
||||||
|
# autologin on serial console
|
||||||
|
sed -i 's/^#* *ttyS0.*/ttyS0::respawn:\/bin\/login -f root/' /etc/inittab
|
@ -1,43 +1,29 @@
|
|||||||
#!/bin/sh
|
# install additional packages
|
||||||
#
|
apk add nano busybox-extras
|
||||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
set -e
|
# network configuration
|
||||||
|
cat > /etc/network/interfaces << EOF
|
||||||
|
#
|
||||||
|
# This is a sample network config, uncomment lines to configure the network
|
||||||
|
#
|
||||||
|
|
||||||
export KEYMAPOPTS="us us"
|
# Loopback interface
|
||||||
export HOSTNAMEOPTS="-n alpine"
|
|
||||||
export INTERFACESOPTS="
|
|
||||||
auto lo
|
auto lo
|
||||||
iface lo inet loopback
|
iface lo inet loopback
|
||||||
|
|
||||||
auto eth0
|
# Static config for eth0
|
||||||
iface eth0 inet dhcp"
|
#auto eth0
|
||||||
export TIMEZONEOPTS="-z UTC"
|
#iface eth0 inet static
|
||||||
export PROXYOPTS="none"
|
# address 192.168.0.2
|
||||||
export APKREPOSOPTS="-r"
|
# netmask 255.255.255.0
|
||||||
export SSHDOPTS="-c openssh"
|
# gateway 192.168.0.1
|
||||||
export NTPOPTS="-c none"
|
# up echo nameserver 192.168.0.1 > /etc/resolv.conf
|
||||||
export SWAP_SIZE=0
|
|
||||||
|
|
||||||
# Answer to password question twice and yes to format drive
|
# DHCP config for eth0
|
||||||
setup-alpine <<EOF
|
# auto eth0
|
||||||
gns3
|
# iface eth0 inet dhcp
|
||||||
gns3
|
# hostname $(hostname)
|
||||||
sda
|
|
||||||
sys
|
|
||||||
y
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
cat > /etc/resolv.conf << EOF
|
||||||
|
EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user