# Makefile for shrx # # Copyright (C) 2019 Stack41, LLC. # # 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 . SHELL := /usr/bin/env bash mkdir=mkdir -p setup_bridge=br0 # Should have Internet access run_bridge=br1 # Should be on its own VLAN boot_disk_size=2G data_disk_size=10G define randmac $(shell openssl rand -hex 5 | sed 's/\(..\)/\1:/g; s/.$$//' | sed 's/^ *//;s/ *$$//' | xargs -I mac echo 00:mac) endef .PHONY: clean clean: rm -rf "os" os: $(mkdir) "$@" # Alpine Linux .PHONY: alpine-3.8.2 alpine-3.8.2: os/alpine-3.8.2-boot.qcow2 os/alpine-3.8.2-boot.qcow2: source/alpine-3.8.2/alpine-virt-3.8.2-x86_64.iso os qemu-img create -f qcow2 "$@" ${boot_disk_size} expect -f "source/alpine-3.8.2/build-boot-disk.exp" ${setup_bridge} "$<" "$@" "source/alpine-3.8.2" # pfSense mgmt_bridge=brmgmt sync_bridge=brsync lan_bridge=brserv wan_bridge=br0 # This is NOT the same as ${run_bridge} mgmt_mac=$(call randmac) sync_mac=$(call randmac) lan_mac=$(call randmac) wan_mac=$(call randmac) .PHONY: pfsense-2.4.4 pfsense-2.4.4: os/pfsense-2.4.4-boot.qcow2 os/pfsense-2.4.4-boot.qcow2: source/pfsense-2.4.4/pfSense-CE-memstick-serial-2.4.4-RELEASE-p1-amd64.img os qemu-img create -f qcow2 "$@" ${boot_disk_size} expect -f "source/pfsense-2.4.4/build-boot-disk.exp" \ ${mgmt_bridge} ${mgmt_mac} \ ${sync_bridge} ${sync_mac} \ ${lan_bridge} ${lan_mac} \ ${wan_bridge} ${wan_mac} \ "$<" \ "$@"