FreeBSD context (#120)
* BSD context * BSD service scripts * Added ToDo * Add context scripts * Freebsd packaging * Freebsd packaging finished * Rollback OS detection * Fix bug with default gateway configuration * Add services for pfsense * Remove bsd context script * Replace /bin/bash with /usr/bin/env bash * Remove /bin/bash symlink creation * Fix service naming * Replace /bin/bash for /bin/sh on BSD service scripts * Fix hardcoded cdrom drive * Fix service start on boot bug on pfsense * Fix bug when creating new users * Fix bud with sudo * Fix bug with crypted passwords * Fix bug with hostname * Fix sed bug related to hostname * Fix bug with domains * Fixed bug: variable should be localpull/133/head
parent
5a73ce7323
commit
26d4cc6419
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rm /etc/one-context.d/loc-05-grow-rootfs /etc/one-context.d/loc-10-network-pci /etc/one-context.d/loc-14-mount-swap
|
||||||
|
rm /etc/one-context.d/loc-30-console /etc/one-context.d/net-11-fix-loopback /etc/one-context.d/net-99-report-ready
|
@ -0,0 +1,255 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2016, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
COMMAND=${1}
|
||||||
|
|
||||||
|
# Gets IP address from a given MAC
|
||||||
|
mac2ip() {
|
||||||
|
mac=$1
|
||||||
|
|
||||||
|
let ip_a=0x`echo $mac | cut -d: -f 3`
|
||||||
|
let ip_b=0x`echo $mac | cut -d: -f 4`
|
||||||
|
let ip_c=0x`echo $mac | cut -d: -f 5`
|
||||||
|
let ip_d=0x`echo $mac | cut -d: -f 6`
|
||||||
|
|
||||||
|
ip="$ip_a.$ip_b.$ip_c.$ip_d"
|
||||||
|
|
||||||
|
echo $ip
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets the network part of an IP
|
||||||
|
get_network() {
|
||||||
|
network=$(get_iface_var "NETWORK")
|
||||||
|
|
||||||
|
if [ -z "$network" ]; then
|
||||||
|
network="$(echo $IP | cut -d'.' -f1,2,3).0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $network
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets the network mask
|
||||||
|
get_mask() {
|
||||||
|
mask=$(get_iface_var "MASK")
|
||||||
|
|
||||||
|
if [ -z "$mask" ]; then
|
||||||
|
mask="255.255.255.0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $mask
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets device MTU
|
||||||
|
get_mtu() {
|
||||||
|
mtu=$(get_iface_var "MTU")
|
||||||
|
|
||||||
|
echo $mtu
|
||||||
|
}
|
||||||
|
|
||||||
|
is_gateway() {
|
||||||
|
if [ -z "$GATEWAY_IFACE_NUM" ]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
[ "$IFACE_NUM" = "$GATEWAY_IFACE_NUM" ]
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets the network gateway
|
||||||
|
get_gateway() {
|
||||||
|
if is_gateway; then
|
||||||
|
gateway=$(get_iface_var "GATEWAY")
|
||||||
|
|
||||||
|
echo $gateway
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets the network gateway6
|
||||||
|
get_gateway6() {
|
||||||
|
if is_gateway; then
|
||||||
|
get_iface_var "GATEWAY6"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_ip() {
|
||||||
|
ip=$(get_iface_var "IP")
|
||||||
|
|
||||||
|
echo $ip
|
||||||
|
}
|
||||||
|
|
||||||
|
get_iface_var() {
|
||||||
|
var_name="${UPCASE_DEV}_$1"
|
||||||
|
var=$(eval "echo \"\${$var_name}\"")
|
||||||
|
|
||||||
|
echo $var
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_iface_conf() {
|
||||||
|
cat <<EOT
|
||||||
|
ifconfig_$DEV="inet $IP netmask $MASK"
|
||||||
|
EOT
|
||||||
|
|
||||||
|
if [ -n "$MTU" ]; then
|
||||||
|
echo "ifconfig_$DEV=\"inet $IP netmask $MASK mtu $MTU\""
|
||||||
|
else
|
||||||
|
echo "ifconfig_$DEV=\"inet $IP netmask $MASK\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$GATEWAY" ]; then
|
||||||
|
echo "defaultrouter=\"$GATEWAY\"" > /etc/rc.conf.d/routing
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_iface6_conf() {
|
||||||
|
if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
|
||||||
|
echo "IPADDR_0=$IP6/${IP6_PREFIX_LENGTH:-64}"
|
||||||
|
|
||||||
|
cat <<EOT >> /etc/sysconfig/network/ifsysctl-$DEV
|
||||||
|
net.ipv6.conf.\$SYSCTL_IF.autoconf = 0
|
||||||
|
net.ipv6.conf.\$SYSCTL_IF.accept_ra = 0
|
||||||
|
EOT
|
||||||
|
else
|
||||||
|
cat <<EOT
|
||||||
|
IPV6INIT=yes
|
||||||
|
IPV6ADDR=$IP6/${IP6_PREFIX_LENGTH:-64}
|
||||||
|
IPV6_AUTOCONF=no
|
||||||
|
EOT
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$IP6_ULA" ]; then
|
||||||
|
if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
|
||||||
|
echo "IPADDR_1=$IP6_ULA/64"
|
||||||
|
else
|
||||||
|
echo "IPV6ADDR_SECONDARIES=$IP6_ULA/64"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$GATEWAY6" ]; then
|
||||||
|
if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
|
||||||
|
echo "default $GATEWAY6 - $DEV" >> /etc/sysconfig/network/ifroute-$DEV
|
||||||
|
else
|
||||||
|
echo "IPV6_DEFAULTGW=$GATEWAY6"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$MTU" ]; then
|
||||||
|
echo "IPV6_MTU=$MTU"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_interface_mac()
|
||||||
|
{
|
||||||
|
macs_array=($(ifconfig | grep ether | awk '{print $2}'))
|
||||||
|
#iface_name=()
|
||||||
|
|
||||||
|
for mac in "${macs_array[@]}"
|
||||||
|
do
|
||||||
|
echo "$(ifconfig | grep -B 2 $mac | head -n 1 | awk '{print $1}' | cut -d ':' -f 1) $mac"
|
||||||
|
#iface_mac+=$(ifconfig | grep -B 2 $mac | head -n 1 | awk '{print $1}' | cut -d ':' -f 1)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
get_context_interfaces()
|
||||||
|
{
|
||||||
|
env | grep -E "^ETH[0-9]+_MAC=" | sed 's/_.*$//' | sort
|
||||||
|
}
|
||||||
|
|
||||||
|
get_dev()
|
||||||
|
{
|
||||||
|
list="$1"
|
||||||
|
mac="$2"
|
||||||
|
|
||||||
|
echo "$list" | grep "$mac" | cut -d' ' -f1 | tail -n1
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_network_configuration()
|
||||||
|
{
|
||||||
|
if [ -d /etc/rc.conf.d ]; then
|
||||||
|
CONFIG_PATH=/etc/rc.conf.d
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo > /etc/rc.conf.d/network
|
||||||
|
|
||||||
|
INTERFACE_MAC=$(get_interface_mac)
|
||||||
|
CONTEXT_INTERFACES=$(get_context_interfaces)
|
||||||
|
GATEWAY_IFACE_NUM=$(echo "$GATEWAY_IFACE" | sed 's/^ETH//')
|
||||||
|
|
||||||
|
for interface in $CONTEXT_INTERFACES; do
|
||||||
|
UPCASE_DEV=$interface
|
||||||
|
MAC=$(get_iface_var "MAC")
|
||||||
|
DEV=$(get_dev "$INTERFACE_MAC" "$MAC")
|
||||||
|
IFACE_NUM=$(echo "$UPCASE_DEV" | sed 's/^ETH//')
|
||||||
|
|
||||||
|
IP=$(get_ip)
|
||||||
|
NETWORK=$(get_network)
|
||||||
|
MASK=$(get_mask)
|
||||||
|
MTU=$(get_mtu)
|
||||||
|
GATEWAY=$(get_gateway)
|
||||||
|
|
||||||
|
IP6=$(get_iface_var "IP6")
|
||||||
|
[[ -z $IP6 ]] && IP6=$(get_iface_var "IPV6")
|
||||||
|
IP6_PREFIX_LENGTH=$(get_iface_var "IP6_PREFIX_LENGTH")
|
||||||
|
IP6_ULA=$(get_iface_var "IP6_ULA")
|
||||||
|
GATEWAY6=$(get_gateway6)
|
||||||
|
|
||||||
|
[ -z "${IP}${IP6}" ] && continue
|
||||||
|
[ -z "${DEV}" ] && continue
|
||||||
|
|
||||||
|
|
||||||
|
(
|
||||||
|
[[ -n $IP ]] && gen_iface_conf
|
||||||
|
#[[ -n $IP6 ]] && gen_iface6_conf
|
||||||
|
|
||||||
|
|
||||||
|
) >> ${CONFIG_PATH}/network
|
||||||
|
|
||||||
|
|
||||||
|
# (
|
||||||
|
# rm -f /etc/sysconfig/network/ifroute-$DEV
|
||||||
|
# rm -f /etc/sysconfig/network/ifsysctl-$DEV
|
||||||
|
#
|
||||||
|
# cat <<EOT
|
||||||
|
#DEVICE=$DEV
|
||||||
|
#BOOTPROTO=static
|
||||||
|
#NM_CONTROLLED=no
|
||||||
|
#TYPE=Ethernet
|
||||||
|
#EOT
|
||||||
|
# ) >> ${CONFIG_PATH}/ifcfg-${DEV}
|
||||||
|
|
||||||
|
service netif restart
|
||||||
|
service routing restart
|
||||||
|
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_network()
|
||||||
|
{
|
||||||
|
gen_network_configuration
|
||||||
|
|
||||||
|
if [ "${COMMAND}" = 'reconfigure' ]; then
|
||||||
|
service network restart
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$(env | cut -d= -f1 | grep -E '^ETH[0-9]+_IPV*6*')" ] && exit 0
|
||||||
|
|
||||||
|
configure_network
|
||||||
|
|
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2016, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
# defaults
|
||||||
|
USERNAME=${USERNAME:-root}
|
||||||
|
USERNAME_SHELL=${USERNAME_SHELL:-/usr/local/bin/bash}
|
||||||
|
USERNAME_SUDO=${USERNAME_SUDO:-${GRANT_SUDO:-YES}}
|
||||||
|
USERNAME_SUDO=$(echo "${USERNAME_SUDO}" | tr '[:lower:]' '[:upper:]')
|
||||||
|
USERNAME_PASSWORD_RESET=${USERNAME_PASSWORD_RESET:-NO}
|
||||||
|
USERNAME_PASSWORD_RESET=$(echo "${USERNAME_PASSWORD_RESET}" | tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
|
if ! getent passwd "${USERNAME}" > /dev/null 2>&1; then
|
||||||
|
pw useradd "${USERNAME}" -m -s "${USERNAME_SHELL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${USERNAME_SUDO}" == "YES" ] && [ "${USERNAME}" != "root" ]; then
|
||||||
|
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >/usr/local/etc/sudoers.d/one-context
|
||||||
|
chmod 0440 /etc/sudoers.d/one-context
|
||||||
|
elif [ -f /etc/sudoers.d/one-context ]; then
|
||||||
|
unlink /etc/sudoers.d/one-context
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${CRYPTED_PASSWORD_BASE64}" ]; then
|
||||||
|
CRYPTED_PASSWORD=$(echo $CRYPTED_PASSWORD_BASE64 | base64 -d)
|
||||||
|
echo $CRYPTED_PASSWORD | pw mod user $USERNAME -H 0
|
||||||
|
elif [ -n "${PASSWORD_BASE64}" ]; then
|
||||||
|
PASSWORD=$(echo $PASSWORD_BASE64 | base64 -d)
|
||||||
|
echo $PASSWORD | pw mod user $USERNAME -h 0
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
passwd "${USERNAME}" <<EOF
|
||||||
|
${PASSWORD}
|
||||||
|
${PASSWORD}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
elif [ -n "${CRYPTED_PASSWORD}" ]; then
|
||||||
|
echo $CRYPTED_PASSWORD | pw mod user $USERNAME -H 0
|
||||||
|
elif [ -n "${PASSWORD}" ]; then
|
||||||
|
echo $PASSWORD | pw mod user $USERNAME -h 0
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
passwd "${USERNAME}" <<EOF
|
||||||
|
${PASSWORD}
|
||||||
|
${PASSWORD}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
elif [ "${USERNAME_PASSWORD_RESET}" = 'YES' ]; then
|
||||||
|
if command -v usermod >/dev/null 2>&1; then
|
||||||
|
pw usermod -p '*' "${USERNAME}"
|
||||||
|
fi
|
||||||
|
fi
|
@ -0,0 +1,133 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function set_hostname() {
|
||||||
|
local hostname=$1
|
||||||
|
|
||||||
|
if [ -d /run/systemd/system/ ]; then
|
||||||
|
hostnamectl set-hostname --static "${hostname}"
|
||||||
|
else
|
||||||
|
if [ -f /etc/sysconfig/network ]; then
|
||||||
|
sed -i '/^HOSTNAME=.*$/d' /etc/sysconfig/network
|
||||||
|
echo "HOSTNAME=${hostname}" >>/etc/sysconfig/network
|
||||||
|
else
|
||||||
|
echo "${hostname}" >/etc/hostname
|
||||||
|
fi
|
||||||
|
|
||||||
|
hostname "${hostname}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_domainname() {
|
||||||
|
domain=$1
|
||||||
|
sed -i '/^domain .*/d' /etc/resolv.conf
|
||||||
|
echo "domain ${domain}" >>/etc/resolv.conf
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_first_ip() {
|
||||||
|
local ip
|
||||||
|
|
||||||
|
ip=${ip:-$(ifconfig | grep inet | head -n 1 | awk '{print $2}')}
|
||||||
|
echo "${ip}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_dns_name() {
|
||||||
|
text=$(LC_ALL=C getent hosts "$1" 2>/dev/null)
|
||||||
|
[ $? = 0 ] || exit 0
|
||||||
|
[[ $text == *"has no PTR record" ]] && exit 0
|
||||||
|
name=$(echo "$text" | awk '/(has address|name pointer)/ {print $(NF)}' | sed 's/\.$//')
|
||||||
|
echo $name
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_hosts() {
|
||||||
|
ip=$1
|
||||||
|
name=$2
|
||||||
|
hostname=$3
|
||||||
|
|
||||||
|
if [ "x${hostname}" = "x${name}" ]; then
|
||||||
|
hosts="${name}"
|
||||||
|
else
|
||||||
|
hosts="${name} ${hostname}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
note='# one-contextd'
|
||||||
|
entry="${ip}$(printf '\t')${hosts}$(printf '\t')$(printf '\t')${note}"
|
||||||
|
newline="$(printf '\n')"
|
||||||
|
|
||||||
|
# update our old entry
|
||||||
|
if grep -qi "${note}" /etc/hosts; then
|
||||||
|
sed -i -e "s/^.*${note}/${entry}/" /etc/hosts
|
||||||
|
# update entry with same IP (but not localhost)
|
||||||
|
elif grep -E "^${ip}\s" /etc/hosts | grep -qv localhost; then
|
||||||
|
sed -i -e "/localhost/! s/^${ip}\s.*\$/${entry}/" /etc/hosts
|
||||||
|
# update entry with same name
|
||||||
|
elif grep -qE "\s${name}(\s|#|\$)" /etc/hosts; then
|
||||||
|
sed -i -re "s/^.*\s${name}([ #\t].*|$)/${entry}/" /etc/hosts
|
||||||
|
# create new entry
|
||||||
|
elif [ -f /etc/hosts ]; then
|
||||||
|
sed -i -e '1s/^/'"${entry}"$'\\\n/' /etc/hosts
|
||||||
|
else
|
||||||
|
echo -e "${entry}" >>/etc/hosts
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#####
|
||||||
|
|
||||||
|
first_ip=$(get_first_ip)
|
||||||
|
|
||||||
|
if [ -n "$SET_HOSTNAME" ]; then
|
||||||
|
name=$(echo "$SET_HOSTNAME" | \
|
||||||
|
sed -e 's/[^-a-zA-Z0-9\.]/-/g' -e 's/^-*//g' -e 's/-*$//g')
|
||||||
|
|
||||||
|
elif [ -n "$DNS_HOSTNAME" ]; then
|
||||||
|
name=$(get_dns_name "${first_ip}")
|
||||||
|
|
||||||
|
elif [ "${EC2_HOSTNAME}" = 'YES' ]; then
|
||||||
|
# try to quickly get hostname from the EC2 metadata server or
|
||||||
|
# create hostname based on the first IPv4 (format: "ip-1-2-3-4")
|
||||||
|
name=$(curl -sf -m 5 'http://169.254.169.254/latest/meta-data/local-hostname' 2>/dev/null)
|
||||||
|
if [ -z "${name}" ]; then
|
||||||
|
name="$(echo "${first_ip}" | grep -x '[0-9\.]\+' | tr . -)"
|
||||||
|
if [ -n "${name}" ]; then
|
||||||
|
name="ip-${name}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${name}" ]; then
|
||||||
|
# split host and domain names
|
||||||
|
hostname=${name%%.*}
|
||||||
|
domain=${name#*.}
|
||||||
|
if [ "x${domain}" = "x${hostname}" ]; then
|
||||||
|
domain=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${domain}" ]; then
|
||||||
|
set_hostname "${hostname}.${domain}"
|
||||||
|
else
|
||||||
|
set_hostname "${hostname}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${domain}" ]; then
|
||||||
|
set_domainname "${domain}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${DNS_HOSTNAME}" ]; then
|
||||||
|
host_ip=$first_ip
|
||||||
|
else
|
||||||
|
# If selected hostname resolves on first IP,
|
||||||
|
# use first IP for local hostname in /etc/hosts.
|
||||||
|
# Otherwise use loopback IP.
|
||||||
|
name_ip=$(get_dns_name "${name}")
|
||||||
|
if [ "x${first_ip}" = "x${name_ip}" ]; then
|
||||||
|
host_ip=$first_ip
|
||||||
|
elif [ -f /etc/debian_version ]; then
|
||||||
|
host_ip='127.0.1.1'
|
||||||
|
else
|
||||||
|
host_ip='127.0.0.1'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${host_ip}" ]; then
|
||||||
|
update_hosts "${host_ip}" "${name}" "${hostname}"
|
||||||
|
fi
|
||||||
|
fi
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: LOGIN netif
|
||||||
|
# PROVIDE: one-context
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context"
|
||||||
|
desc="OpenNebula's context scripts"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-contextd"
|
||||||
|
command_args="network"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: one-context-local one-context
|
||||||
|
# PROVIDE: one-context-force
|
||||||
|
# Short-Description: OpenNebula forced reconfiguration
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context_force"
|
||||||
|
desc="OpenNebula forced reconfiguration"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-context-run"
|
||||||
|
command_args="force"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_force_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: FILESYSTEMS
|
||||||
|
# PROVIDE: one-context-local
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context_local"
|
||||||
|
desc="OpenNebula pre-networking contextualization"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-contextd"
|
||||||
|
command_args="local"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_local_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: one-context-local one-context
|
||||||
|
# PROVIDE: one-context-reconfigure-delayed
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context_reconfigure_delayed"
|
||||||
|
desc="OpenNebula delayed reconfiguration"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-context-run"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_reconfigure_delayed_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: one-context-local one-context
|
||||||
|
# PROVIDE: one-context-reconfigure
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="one_context_reconfigure"
|
||||||
|
desc="OpenNebula reconfiguration"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-context-run"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_reconfigure_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: one-context-local one-context
|
||||||
|
# PROVIDE: one-context-force
|
||||||
|
# Short-Description: OpenNebula forced reconfiguration
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context_force"
|
||||||
|
desc="OpenNebula forced reconfiguration"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-context-run"
|
||||||
|
command_args="force"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_force_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: FILESYSTEMS
|
||||||
|
# PROVIDE: one-context-local
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context_local"
|
||||||
|
desc="OpenNebula pre-networking contextualization"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-contextd"
|
||||||
|
command_args="local"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_local_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: one-context-local one-context
|
||||||
|
# PROVIDE: one-context-reconfigure-delayed
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context_reconfigure_delayed"
|
||||||
|
desc="OpenNebula delayed reconfiguration"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-context-run"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_reconfigure_delayed_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: LOGIN netif
|
||||||
|
# PROVIDE: one-context
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
|
||||||
|
|
||||||
|
name="one_context"
|
||||||
|
desc="OpenNebula's context scripts"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-contextd"
|
||||||
|
command_args="network"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# REQUIRE: one-context-local one-context
|
||||||
|
# PROVIDE: one-context-reconfigure
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="one_context_reconfigure"
|
||||||
|
desc="OpenNebula reconfiguration"
|
||||||
|
rcvar="${name}_enable"
|
||||||
|
|
||||||
|
command="/usr/sbin/one-context-run"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${one_context_reconfigure_enable:="yes"}
|
||||||
|
run_rc_command "$1"
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue