Feb 25, 2020

This commit is contained in:
Charlie Root
2020-02-25 11:28:31 -08:00
commit f26cf87f5a
436 changed files with 67904 additions and 0 deletions

View File

@ -0,0 +1,12 @@
unbind C-b
set -g prefix C-a
bind C-a send-prefix
setw -g mouse on
# Set the default terminal mode to 256color mode
set -g default-terminal "xterm-256color"
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on

35
jails/config/vm/create_taps.sh Executable file
View File

@ -0,0 +1,35 @@
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/bin/sh
#
ifconfig tap81 create
ifconfig bridge1 addm tap81 up
ifconfig tap81 up
ifconfig tap81 inet6 auto_linklocal
ifconfig tap82 create
ifconfig bridge1 addm tap82 up
ifconfig tap82 up
ifconfig tap82 inet6 auto_linklocal
ifconfig tap83 create
ifconfig bridge1 addm tap83 up
ifconfig tap83 up
ifconfig tap83 inet6 auto_linklocal
ifconfig tap90 create
ifconfig bridge1 addm tap90 up
ifconfig tap90 up
ifconfig tap90 inet6 auto_linklocal
ifconfig tap190 create
ifconfig bridge2 addm tap190 up
ifconfig tap190 up
ifconfig tap190 inet6 auto_linklocal

64
jails/config/vm/freebsd.sh Executable file
View File

@ -0,0 +1,64 @@
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/usr/local/bin/bash
# ./freebsd.sh under tmux
# clean cached state
bhyvectl --destroy --vm=freebsd
while true
do
bhyve -c 4 -m 8G -A -H -P \
-s 0,hostbridge \
-s 3,ahci-cd \
-s 4,virtio-blk,/dev/zvol/ship/raw/freebsd \
-s 5,virtio-net,tap83,mac=00:0A:0B:0C:0D:83 \
-s 29,fbuf,tcp=0.0.0.0:5983,w=1600,h=900 \
-s 30,xhci,tablet \
-s 31,lpc -l com1,/dev/nmdm83A \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
freebsd
bhyve_exit=$?
# bhyve returns the following status codes:
# 0 - VM has been reset
# 1 - VM has been powered off
# 2 - VM has been halted
# 3 - VM generated a triple fault
# all other non-zero status codes are errors
#
if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ]
then
break
fi
echo `date` - restarting freebsd in 5 seconds - press ctrl-c to stop
sleep 5
done
exit $?
#-s 3,ahci-cd \
#-s 3,ahci-cd,/mnt/freebsd/FreeBSD-12.1-RELEASE-amd64-disc1.iso \
# set boot_serial=NO
# first in boot menu option 3 and then /boot/loader.conf after install
# bhyvectl --get-all --vm=freebsd
# cu -l /dev/nmdm83B
# (This uses cu() so press ~+Ctrl-D to exit)
#on base system:
#zfs create -V 32G -o refreservation=none ship/raw/freebsd
# on boot
#ifconfig tap83 create
#ifconfig bridge1 addm tap83 up
#ifconfig tap83 up
#ifconfig tap83 inet6 auto_linklocal

67
jails/config/vm/pbx.sh Executable file
View File

@ -0,0 +1,67 @@
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/usr/local/bin/bash
# ./pbx.sh under tmux
# clean cached state
bhyvectl --destroy --vm=pbx
while true
do
bhyve -c 2 -m 8G -A -H -P \
-s 0,hostbridge \
-s 3,ahci-cd \
-s 4,virtio-blk,/dev/zvol/ship/raw/pbx \
-s 5,virtio-net,tap90,mac=00:0A:0B:0C:0D:90 \
-s 6,virtio-net,tap190,mac=00:0A:0B:0C:0D:190 \
-s 29,fbuf,tcp=0.0.0.0:5990,w=1600,h=900 \
-s 30,xhci,tablet \
-s 31,lpc -l com1,/dev/nmdm90A \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
pbx
bhyve_exit=$?
# bhyve returns the following status codes:
# 0 - VM has been reset
# 1 - VM has been powered off
# 2 - VM has been halted
# 3 - VM generated a triple fault
# all other non-zero status codes are errors
#
if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ]
then
break
fi
echo `date` - restarting ubuntu in 5 seconds - press ctrl-c to stop
sleep 5
done
exit $?
# -s 3,ahci-cd \
# -s 3,ahci-cd,/mnt/linux/SNG7-FPBX-64bit-1904-2.iso \
# bhyvectl --get-all --vm=pbx
# cu -l /dev/nmdm90B
# (This uses cu() so press ~+Ctrl-D to exit)
#on base system:
#zfs create -V 32G -o refreservation=none ship/raw/pbx
# on boot
#ifconfig tap90 create
#ifconfig bridge1 addm tap90 up
#ifconfig tap90 up
#ifconfig tap90 inet6 auto_linklocal
#ifconfig tap190 create
#ifconfig bridge2 addm tap190 up
#ifconfig tap190 up
#ifconfig tap190 inet6 auto_linklocal

64
jails/config/vm/r-windows.sh Executable file
View File

@ -0,0 +1,64 @@
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/usr/local/bin/bash
# ./r-windows.sh under tmux
# clean cached state
bhyvectl --destroy --vm=r-windows
while true
do
bhyve -c 4 -m 8G -S -A -H -P \
-s 0,hostbridge \
-s 4,ahci-hd,/dev/zvol/ship/raw/windows,sectorsize=512 \
-s 5,virtio-net,tap81,mac=00:0A:0B:0C:0D:81 \
-s 6,ahci-hd,/dev/zvol/ship/raw/windows_data,sectorsize=512 \
-s 29,fbuf,tcp=0.0.0.0:5981,w=1600,h=900 \
-s 30,xhci,tablet \
-s 31,lpc -l com1,/dev/nmdm81A \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
r-windows
bhyve_exit=$?
# bhyve returns the following status codes:
# 0 - VM has been reset
# 1 - VM has been powered off
# 2 - VM has been halted
# 3 - VM generated a triple fault
# all other non-zero status codes are errors
#
if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ]
then
break
fi
echo `date` - restarting r-windows in 5 seconds - press ctrl-c to stop
sleep 5
done
exit $?
# -s 3,ahci,cd:/mnt/windows/w10.iso,cd:/mnt/windows/virtio-win.iso \
# mounting the USB HDD as an attached drive to the system
#-s 3,ahci,cd:/mnt/windows/w10.iso,cd:/mnt/windows/virtio-win.iso,hd:/dev/da3p2 \
# bhyvectl --get-all --vm=r-windows
# cu -l /dev/nmdm81B
# (This uses cu() so press ~+Ctrl-D to exit)
#on base system:
#zfs create -V 32G -o refreservation=none ship/raw/r-windows
#zfs create -V 128G -o refreservation=none ship/raw/r-windows_data
# on boot
#ifconfig tap81 create
#ifconfig bridge1 addm tap81 up
#ifconfig tap81 up
#ifconfig tap81 inet6 auto_linklocal

4
jails/config/vm/setup_jail.sh Executable file
View File

@ -0,0 +1,4 @@
# requrired to run other configured scripts
/bin/sh /etc/rc
# launch tmux with jails
/mnt/config/startvms.sh

41
jails/config/vm/startvms.sh Executable file
View File

@ -0,0 +1,41 @@
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/bin/sh
#
session="vm_tmux"
# set up tmux
tmux start-server
# create a new tmux session, naming the window freepbx
tmux new-session -d -s $session -n freepbx
tmux selectp -t 1
tmux send-keys "cd /mnt/config;./pbx.sh" C-m
# create a new window ubuntu
tmux new-window -t $session:1 -n ubuntu
tmux selectp -t 1
tmux send-keys "cd /mnt/config;./ubuntu.sh" C-m
# create a new window freebsd
tmux new-window -t $session:2 -n freebsd
tmux selectp -t 1
tmux send-keys "cd /mnt/config;./freebsd.sh" C-m
# create a new window r-windows
tmux new-window -t $session:3 -n r-windows
tmux selectp -t 1
tmux send-keys "cd /mnt/config;./r-windows.sh" C-m
# return to main window
tmux select-window -t $session:0
tmux selectp -t 1
# Finished setup, attach to the tmux session!
#tmux attach-session -t $session

63
jails/config/vm/ubuntu.sh Executable file
View File

@ -0,0 +1,63 @@
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/usr/local/bin/bash
# ./ubuntu.sh under tmux
# clean cached state
bhyvectl --destroy --vm=ubuntu
while true
do
bhyve -c 4 -m 16G -A -H -P \
-s 0,hostbridge \
-s 3,ahci-cd \
-s 4,virtio-blk,/dev/zvol/ship/raw/ubuntu \
-s 5,virtio-net,tap82,mac=00:0A:0B:0C:0D:82 \
-s 6,virtio-blk,/dev/zvol/ship/raw/ubuntu_data \
-s 29,fbuf,tcp=0.0.0.0:5982,w=1600,h=900 \
-s 30,xhci,tablet \
-s 31,lpc -l com1,/dev/nmdm82A \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
ubuntu
bhyve_exit=$?
# bhyve returns the following status codes:
# 0 - VM has been reset
# 1 - VM has been powered off
# 2 - VM has been halted
# 3 - VM generated a triple fault
# all other non-zero status codes are errors
#
if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ]
then
break
fi
echo `date` - restarting ubuntu in 5 seconds - press ctrl-c to stop
sleep 5
done
exit $?
# -s 3,ahci-cd,/mnt/linux/ubuntu-18.04.3-server-amd64.iso \
# bhyvectl --get-all --vm=ubuntu
# cu -l /dev/nmdm82B
# (This uses cu() so press ~+Ctrl-D to exit)
#on base system:
#zfs create -V 32G -o refreservation=none ship/raw/ubuntu
#zfs create -V 128G -o refreservation=none ship/raw/ubuntu_data
# on boot
#ifconfig tap82 create
#ifconfig bridge1 addm tap82 up
#ifconfig tap82 up
#ifconfig tap82 inet6 auto_linklocal