Freebsd init script
This commit is contained in:
30
vm_example_scripts/freebsd/init_freebsd.sh
Normal file
30
vm_example_scripts/freebsd/init_freebsd.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/csh
|
||||
|
||||
# Variables
|
||||
set IP = "$1"
|
||||
set HOSTNAME = "$2"
|
||||
set IP_RANGE = `echo "$IP" | sed 's/\.[0-9]*$//'`
|
||||
set IP_GATEWAY = "1"
|
||||
set IP_NETMASK = "255.255.255.0"
|
||||
|
||||
# Jail related config (assuming you need these)
|
||||
sysrc jail_enabled="YES"
|
||||
sysrc cloned_interfaces="lagg0"
|
||||
echo ".include "/etc/jail.conf.d/*.conf";" > /etc/jails.conf
|
||||
|
||||
# Set hostname
|
||||
sysrc hostname="$HOSTNAME.local"
|
||||
|
||||
# Set IP
|
||||
sysrc ifconfig_em0="inet $IP netmask $IP_NETMASK broadcast $IP_RANGE.255"
|
||||
sysrc defaultrouter="$IP_RANGE.$IP_GATEWAY"
|
||||
|
||||
# Set DNS
|
||||
cat > /etc/resolv.conf << EOF
|
||||
nameserver 208.67.222.222
|
||||
nameserver 208.67.220.220
|
||||
EOF
|
||||
|
||||
# Restart network
|
||||
service netif restart
|
||||
service routing restart
|
||||
29
vm_example_scripts/freebsd/jail.conf
Normal file
29
vm_example_scripts/freebsd/jail.conf
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/csh
|
||||
|
||||
# Variables
|
||||
set IP = "$1"
|
||||
set HOSTNAME = "$2"
|
||||
set IP_RANGE = `echo "$IP" | sed 's/\.[0-9]*$//'`
|
||||
set IP_GATEWAY = "1"
|
||||
set IP_NETMASK = "255.255.255.0"
|
||||
|
||||
# Jail related config (assuming you need these)
|
||||
sysrc jail_enabled="YES"
|
||||
sysrc cloned_interfaces="lagg0"
|
||||
|
||||
# Set hostname
|
||||
sysrc hostname="$HOSTNAME.local"
|
||||
|
||||
# Set IP
|
||||
sysrc ifconfig_em0="inet $IP netmask $IP_NETMASK broadcast $IP_RANGE.255"
|
||||
sysrc defaultrouter="$IP_RANGE.$IP_GATEWAY"
|
||||
|
||||
# Set DNS
|
||||
cat > /etc/resolv.conf << EOF
|
||||
nameserver 208.67.222.222
|
||||
nameserver 208.67.220.220
|
||||
EOF
|
||||
|
||||
# Restart network
|
||||
service netif restart
|
||||
service routing restart
|
||||
22
vm_example_scripts/freebsd/jail_manifest.conf
Normal file
22
vm_example_scripts/freebsd/jail_manifest.conf
Normal file
@ -0,0 +1,22 @@
|
||||
_jailname_ {
|
||||
# STARTUP/LOGGING
|
||||
exec.start = "/bin/sh /etc/rc";
|
||||
exec.stop = "/bin/sh /etc/rc.shutdown";
|
||||
exec.poststop = "/sbin/umount -f /usr/local/jails/$name/skeleton; /sbin/umount -f /usr/local/jails/$name";
|
||||
exec.consolelog = "/var/log/jail_console_${name}.log";
|
||||
|
||||
# PERMISSIONS
|
||||
allow.raw_sockets;
|
||||
exec.clean;
|
||||
mount.devfs;
|
||||
|
||||
# HOSTNAME/PATH
|
||||
host.hostname = "${name}";
|
||||
path = "/usr/local/jails/${name}";
|
||||
mount.fstab = "/usr/local/jails/jail.fstab.d/$name.fstab";
|
||||
|
||||
# NETWORK
|
||||
ip4.addr = 192.168.1._IP_;
|
||||
#ip6.addr = ::ffff:c0a8:197
|
||||
interface = lagg0;
|
||||
}
|
||||
29
vm_example_scripts/init_freebsd.sh
Normal file
29
vm_example_scripts/init_freebsd.sh
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/csh
|
||||
|
||||
# Variables
|
||||
set IP = "$1"
|
||||
set HOSTNAME = "$2"
|
||||
set IP_RANGE = `echo "$IP" | sed 's/\.[0-9]*$//'`
|
||||
set IP_GATEWAY = "1"
|
||||
set IP_NETMASK = "255.255.255.0"
|
||||
|
||||
# Jail related config (assuming you need these)
|
||||
sysrc jail_enabled="YES"
|
||||
sysrc cloned_interfaces="lagg0"
|
||||
|
||||
# Set hostname
|
||||
sysrc hostname="$HOSTNAME.local"
|
||||
|
||||
# Set IP
|
||||
sysrc ifconfig_em0="inet $IP netmask $IP_NETMASK broadcast $IP_RANGE.255"
|
||||
sysrc defaultrouter="$IP_RANGE.$IP_GATEWAY"
|
||||
|
||||
# Set DNS
|
||||
cat > /etc/resolv.conf << EOF
|
||||
nameserver 208.67.222.222
|
||||
nameserver 208.67.220.220
|
||||
EOF
|
||||
|
||||
# Restart network
|
||||
service netif restart
|
||||
service routing restart
|
||||
Reference in New Issue
Block a user