From ef254cb0af6437a02c6c1073a82d0dec19986360 Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Tue, 18 Dec 2018 14:28:10 +0100 Subject: [PATCH] gh-131: Improvements to FreeBSD contextualization --- README.md | 8 +- pkg/postinstall | 18 ++- pkg/postinstall.ec2 | 2 +- pkg/postinstall.freebsd | 4 - pkg/postuninstall | 2 +- pkg/postupgrade | 2 +- pkg/preuninstall | 2 +- pkg/preuninstall.ec2 | 2 +- src/etc/one-context.d/loc-05-grow-rootfs | 9 +- src/etc/one-context.d/loc-10-network-pci##one | 2 +- src/etc/one-context.d/loc-14-mount-swap##one | 9 +- .../loc-20-set-username-password | 64 +++++++-- .../loc-20-set-username-password##bsd | 66 --------- src/etc/one-context.d/loc-30-console##one | 5 +- ...back##one => net-11-fix-loopback##deb.one} | 0 src/etc/one-context.d/net-15-hostname | 40 ++++-- src/etc/one-context.d/net-15-hostname##bsd | 133 ------------------ src/etc/rc.d/one-context##bsd_rc.one | 3 +- src/etc/rc.d/one-context-force##bsd_rc.one | 4 +- src/etc/rc.d/one-context-local##bsd_rc.one | 5 +- .../rc.d/one-context-reconfigure##bsd_rc.one | 9 +- ...ne-context-reconfigure-delayed##bsd_rc.one | 4 +- targets.sh | 4 +- 23 files changed, 139 insertions(+), 258 deletions(-) delete mode 100755 pkg/postinstall.freebsd delete mode 100755 src/etc/one-context.d/loc-20-set-username-password##bsd rename src/etc/one-context.d/{net-11-fix-loopback##one => net-11-fix-loopback##deb.one} (100%) delete mode 100755 src/etc/one-context.d/net-15-hostname##bsd diff --git a/README.md b/README.md index bd6b4c5..7b1a0e9 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,16 @@ Latest versions can be downloaded from the | Platform | Versions | |-------------------------------------|----------------------------------------| | CentOS | 6, 7 | -| Fedora | 27, 28 | +| Red Hat Enterprise Linux | 7 | +| Fedora | 28, 29 | | openSUSE | 42.3, 15 | | SUSE Linux Enterprise Server (SLES) | 12 SP3 | -| Debian | 8, 9 | +| Debian | 8, 9, 10 | | Devuan | 1, 2 | -| Ubuntu | 14.04, 16.04, 18.04 | +| Ubuntu | 14.04, 16.04, 18.04, 18.10 | | Alpine Linux | 3.6, 3.7, 3.8 | | Amazon Linux | 2 | +| FreeBSD | 11.2, 12.0 | ## Development diff --git a/pkg/postinstall b/pkg/postinstall index 1103f77..4823521 100755 --- a/pkg/postinstall +++ b/pkg/postinstall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash NETWORK=${NETWORK:-yes} NETWORK_EC2=${NETWORK_EC2:-no} @@ -46,6 +46,9 @@ elif which rc-update >/dev/null 2>&1; then rc-update add "${S}" boot >/dev/null 2>&1 done +elif [ -f /etc/rc.conf ]; then + : + else echo 'WARNING: Contextualization service not enabled automatically' >&2 fi @@ -131,3 +134,16 @@ USERCONTROL=yes EOT fi fi + +# FreeBSD based distros +#TODO: pfsense paths? +if [ -f /etc/rc.conf ]; then + rm -f /etc/rc.conf.d/network /etc/rc.conf.d/routing + + sed -i '' \ + -e '/^ifconfig_/d' \ + -e '/^route_/d' \ + -e '/^static_routes/d' \ + -e '/^defaultrouter/d' \ + /etc/rc.conf +fi diff --git a/pkg/postinstall.ec2 b/pkg/postinstall.ec2 index 7043895..b01e1f0 100755 --- a/pkg/postinstall.ec2 +++ b/pkg/postinstall.ec2 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash NETWORK_EC2=yes SERVICES='one-context' diff --git a/pkg/postinstall.freebsd b/pkg/postinstall.freebsd deleted file mode 100755 index cf89a17..0000000 --- a/pkg/postinstall.freebsd +++ /dev/null @@ -1,4 +0,0 @@ -#!/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 diff --git a/pkg/postuninstall b/pkg/postuninstall index 6c42b36..d47a1e2 100755 --- a/pkg/postuninstall +++ b/pkg/postuninstall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash udevadm control --reload >/dev/null 2>&1 || : diff --git a/pkg/postupgrade b/pkg/postupgrade index 6c42b36..d47a1e2 100755 --- a/pkg/postupgrade +++ b/pkg/postupgrade @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash udevadm control --reload >/dev/null 2>&1 || : diff --git a/pkg/preuninstall b/pkg/preuninstall index ddec50d..f742a59 100755 --- a/pkg/preuninstall +++ b/pkg/preuninstall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash SERVICES=${SERVICES:-one-context one-context-local} diff --git a/pkg/preuninstall.ec2 b/pkg/preuninstall.ec2 index a51f172..a824d52 100755 --- a/pkg/preuninstall.ec2 +++ b/pkg/preuninstall.ec2 @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash SERVICES='one-context' diff --git a/src/etc/one-context.d/loc-05-grow-rootfs b/src/etc/one-context.d/loc-05-grow-rootfs index c9cae2b..d3504aa 100755 --- a/src/etc/one-context.d/loc-05-grow-rootfs +++ b/src/etc/one-context.d/loc-05-grow-rootfs @@ -1,6 +1,13 @@ -#!/bin/sh +#!/usr/bin/env bash + set -e +# FreeBSD +if [ -x /etc/rc.d/growfs ]; then + /etc/rc.d/growfs onestart + exit $? +fi + MOUNT_LINE=$(cat /etc/mtab | grep ' / ' | grep -v '^rootfs') DEVICE=$(echo "$MOUNT_LINE" | cut -d' ' -f1) FSTYPE=$(echo "$MOUNT_LINE" | cut -d' ' -f3) diff --git a/src/etc/one-context.d/loc-10-network-pci##one b/src/etc/one-context.d/loc-10-network-pci##one index d1aae3d..1893d3b 100755 --- a/src/etc/one-context.d/loc-10-network-pci##one +++ b/src/etc/one-context.d/loc-10-network-pci##one @@ -31,7 +31,7 @@ get_pci_interfaces() get_dev_from_pci() { - DEV=$(find /sys/class/net/*/device -lname "*$1" | awk -F '/' '{print $5}') + DEV=$(find /sys/class/net/*/device -lname "*$1" 2>/dev/null | awk -F '/' '{print $5}') if [ -z "$DEV" ]; then echo "PCI Device $1 not found" >&2 diff --git a/src/etc/one-context.d/loc-14-mount-swap##one b/src/etc/one-context.d/loc-14-mount-swap##one index 68e46d8..01f4cbe 100755 --- a/src/etc/one-context.d/loc-14-mount-swap##one +++ b/src/etc/one-context.d/loc-14-mount-swap##one @@ -1,15 +1,14 @@ #!/usr/bin/env bash -activate_swaps() { - +activate_swaps_linux() { SWAP_DRIVES=$(blkid -t TYPE="swap" -o device) for SWAP in $SWAP_DRIVES ; do if [ -z "$(swapon -s | grep $SWAP)" ]; then swapon $SWAP fi done - } -activate_swaps - +if [ "$(uname -s)" = 'Linux' ]; then + activate_swaps_linux +fi diff --git a/src/etc/one-context.d/loc-20-set-username-password b/src/etc/one-context.d/loc-20-set-username-password index 414606f..1c6fb30 100755 --- a/src/etc/one-context.d/loc-20-set-username-password +++ b/src/etc/one-context.d/loc-20-set-username-password @@ -18,47 +18,85 @@ # defaults USERNAME=${USERNAME:-root} -USERNAME_SHELL=${USERNAME_SHELL:-/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:]') +_kernel="$(uname -s)" +case "${_kernel}" in + 'FreeBSD') + USERNAME_SHELL=${USERNAME_SHELL:-/usr/local/bin/bash} + _sudoers_file='/usr/local/etc/sudoers.d/one-context' + ;; + *) + USERNAME_SHELL=${USERNAME_SHELL:-/bin/bash} + _sudoers_file='/etc/sudoers.d/one-context' + ;; +esac + +# create user if missing if ! getent passwd "${USERNAME}" > /dev/null 2>&1; then - useradd -m "${USERNAME}" -p '*' -s "${USERNAME_SHELL}" + if [ "${_kernel}" = 'FreeBSD' ]; then + pw user add "${USERNAME}" -m -s "${USERNAME_SHELL}" -w no + else + useradd -m "${USERNAME}" -p '*' -s "${USERNAME_SHELL}" + fi fi +# enable sudo if [ "${USERNAME_SUDO}" == "YES" ] && [ "${USERNAME}" != "root" ]; then - echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >/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 + echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >"${_sudoers_file}" + chmod 0440 "${_sudoers_file}" +elif [ -f "${_sudoers_file}" ]; then + unlink "${_sudoers_file}" fi +# set password if [ -n "${CRYPTED_PASSWORD_BASE64}" ]; then CRYPTED_PASSWORD=$(echo $CRYPTED_PASSWORD_BASE64 | base64 -d) - usermod -p "${CRYPTED_PASSWORD}" "${USERNAME}" + if [ "${_kernel}" = 'FreeBSD' ]; then + echo "${CRYPTED_PASSWORD}" | pw user mod "${USERNAME}" -H 0 + else + usermod -p "${CRYPTED_PASSWORD}" "${USERNAME}" + fi elif [ -n "${PASSWORD_BASE64}" ]; then PASSWORD=$(echo $PASSWORD_BASE64 | base64 -d) - chpasswd <<< "${USERNAME}:${PASSWORD}" + if [ "${_kernel}" = 'FreeBSD' ]; then + echo $PASSWORD | pw user mod "${USERNAME}" -h 0 + else + chpasswd <<< "${USERNAME}:${PASSWORD}" + fi if [ $? -ne 0 ]; then 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}" </dev/null 2>&1; then - pw usermod -p '*' "${USERNAME}" - fi -fi diff --git a/src/etc/one-context.d/loc-30-console##one b/src/etc/one-context.d/loc-30-console##one index 9d204bd..0cf9fb9 100755 --- a/src/etc/one-context.d/loc-30-console##one +++ b/src/etc/one-context.d/loc-30-console##one @@ -1,5 +1,6 @@ #!/usr/bin/env bash -for DEV_TTY in /dev/tty[0-9]*; do - TERM=linux setterm -blank 0 -powerdown 0 >>"${DEV_TTY}" +# Linux +for _dev_tty in $(find /dev -type c -name 'tty[0-9]*'); do + TERM=linux setterm -blank 0 -powerdown 0 >>"${_dev_tty}" done diff --git a/src/etc/one-context.d/net-11-fix-loopback##one b/src/etc/one-context.d/net-11-fix-loopback##deb.one similarity index 100% rename from src/etc/one-context.d/net-11-fix-loopback##one rename to src/etc/one-context.d/net-11-fix-loopback##deb.one diff --git a/src/etc/one-context.d/net-15-hostname b/src/etc/one-context.d/net-15-hostname index 9b66e03..abac390 100755 --- a/src/etc/one-context.d/net-15-hostname +++ b/src/etc/one-context.d/net-15-hostname @@ -1,14 +1,23 @@ #!/usr/bin/env bash +_kernel="$(uname -s)" +if [ "${_kernel}" = 'FreeBSD' ]; then + SED_I="sed -i ''" +else + SED_I="sed -i''" +fi + function set_hostname() { - hostname=$1 + 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 + ${SED_I} '/^HOSTNAME=.*$/d' /etc/sysconfig/network echo "HOSTNAME=${hostname}" >>/etc/sysconfig/network + elif [ "${_kernel}" = 'FreeBSD' ]; then + sysrc hostname="${hostname}" else echo "${hostname}" >/etc/hostname fi @@ -19,7 +28,7 @@ function set_hostname() { function set_domainname() { domain=$1 - sed -i '/^domain .*/d' /etc/resolv.conf + ${SED_I} -e '/^domain .*/d' /etc/resolv.conf echo "domain ${domain}" >>/etc/resolv.conf } @@ -28,6 +37,7 @@ function get_first_ip() { ip=${ip:-$(ip route get 1 2>/dev/null | grep 'src [0-9\.]\+' | head -1 | sed -e 's/^.*src \([0-9\.]*\).*$/\1/')} ip=${ip:-$(ip -4 address show scope global up 2>/dev/null | awk '/inet / { gsub(/\/[^\/]+$/, "", $2); print $2; exit}')} + ip=${ip:-$(ifconfig 2>/dev/null | awk '/inet / { gsub(/\/[^\/]+$/, "", $2); print $2; exit}')} ip=${ip:-$(hostname -I 2>/dev/null | cut -d' ' -f1)} ip=${ip:-$(hostname -i 2>/dev/null)} @@ -54,22 +64,22 @@ function update_hosts() { fi note='# one-contextd' - entry="${ip}\t${hosts}\t\t${note}" + entry="${ip} ${hosts} ${note}" # update our old entry if grep -qi "${note}" /etc/hosts; then - sed -i -e "s/^.*${note}\$/${entry}/" /etc/hosts + ${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 + elif grep -E "^${ip}[[:space:]]" /etc/hosts | grep -qv localhost; then + ${SED_I} -e "/localhost/! s/^${ip}[[:space:]].*\$/${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 + elif grep -qE "[[:space:]]${name}([[:space:]]|#|\$)" /etc/hosts; then + ${SED_I} -re "s/^.*[[:space:]]${name}([[:space:]#].*|$)/${entry}/" /etc/hosts # create new entry elif [ -f /etc/hosts ]; then - sed -i -e "1s/^/${entry}\n/" /etc/hosts + ${SED_I} -e "1s/^/${entry}"$'\\\n/' /etc/hosts else - echo -e "${entry}" >>/etc/hosts + echo "${entry}" >>/etc/hosts fi } @@ -104,7 +114,13 @@ if [ -n "${name}" ]; then domain='' fi - set_hostname "${hostname}" + # FreeBSD + if [ "${_kernel}" = 'FreeBSD' ]; then + set_hostname "${name}" + else + set_hostname "${hostname}" + fi + if [ -n "${domain}" ]; then set_domainname "${domain}" fi diff --git a/src/etc/one-context.d/net-15-hostname##bsd b/src/etc/one-context.d/net-15-hostname##bsd deleted file mode 100755 index fa2c6bf..0000000 --- a/src/etc/one-context.d/net-15-hostname##bsd +++ /dev/null @@ -1,133 +0,0 @@ -#!/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 diff --git a/src/etc/rc.d/one-context##bsd_rc.one b/src/etc/rc.d/one-context##bsd_rc.one index 8976417..b6a85ad 100755 --- a/src/etc/rc.d/one-context##bsd_rc.one +++ b/src/etc/rc.d/one-context##bsd_rc.one @@ -17,11 +17,12 @@ #--------------------------------------------------------------------------- # ### BEGIN INIT INFO -# REQUIRE: LOGIN netif # PROVIDE: one-context +# REQUIRE: LOGIN NETWORKING ### 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" diff --git a/src/etc/rc.d/one-context-force##bsd_rc.one b/src/etc/rc.d/one-context-force##bsd_rc.one index fd37f7d..8641181 100755 --- a/src/etc/rc.d/one-context-force##bsd_rc.one +++ b/src/etc/rc.d/one-context-force##bsd_rc.one @@ -23,6 +23,7 @@ ### 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" @@ -33,6 +34,5 @@ command="/usr/sbin/one-context-run" command_args="force" load_rc_config $name -: ${one_context_force_enable:="yes"} +: ${one_context_force_enable:="no"} run_rc_command "$1" - diff --git a/src/etc/rc.d/one-context-local##bsd_rc.one b/src/etc/rc.d/one-context-local##bsd_rc.one index a702ac5..fadf050 100755 --- a/src/etc/rc.d/one-context-local##bsd_rc.one +++ b/src/etc/rc.d/one-context-local##bsd_rc.one @@ -17,11 +17,13 @@ #--------------------------------------------------------------------------- # ### BEGIN INIT INFO -# REQUIRE: FILESYSTEMS # PROVIDE: one-context-local +# REQUIRE: FILESYSTEMS +# BEFORE: NETWORKING hostname ### 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" @@ -34,4 +36,3 @@ command_args="local" load_rc_config $name : ${one_context_local_enable:="yes"} run_rc_command "$1" - diff --git a/src/etc/rc.d/one-context-reconfigure##bsd_rc.one b/src/etc/rc.d/one-context-reconfigure##bsd_rc.one index 74df7f1..11d5a58 100755 --- a/src/etc/rc.d/one-context-reconfigure##bsd_rc.one +++ b/src/etc/rc.d/one-context-reconfigure##bsd_rc.one @@ -23,14 +23,17 @@ . /etc/rc.subr +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin + name="one_context_reconfigure" desc="OpenNebula reconfiguration" rcvar="${name}_enable" command="/usr/sbin/one-context-run" +# run without any delay +export TIMEOUT=0 + load_rc_config $name -: ${one_context_reconfigure_enable:="yes"} +: ${one_context_reconfigure_enable:="no"} run_rc_command "$1" - - diff --git a/src/etc/rc.d/one-context-reconfigure-delayed##bsd_rc.one b/src/etc/rc.d/one-context-reconfigure-delayed##bsd_rc.one index 2a4be52..3aefee3 100755 --- a/src/etc/rc.d/one-context-reconfigure-delayed##bsd_rc.one +++ b/src/etc/rc.d/one-context-reconfigure-delayed##bsd_rc.one @@ -22,6 +22,7 @@ ### 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" @@ -31,6 +32,5 @@ rcvar="${name}_enable" command="/usr/sbin/one-context-run" load_rc_config $name -: ${one_context_reconfigure_delayed_enable:="yes"} +: ${one_context_reconfigure_delayed_enable:="no"} run_rc_command "$1" - diff --git a/targets.sh b/targets.sh index 0bcc2c5..9da6020 100644 --- a/targets.sh +++ b/targets.sh @@ -22,11 +22,11 @@ case "${TARGET}" in TYPE=${TYPE:-freebsd} EXT=${EXT:-txz} TAGS=${TAGS:-bsd bsd_rc one sysv} - DEPENDS=${DEPENDS:-sudo bash curl base64} + DEPENDS=${DEPENDS:-sudo bash curl base64 ruby open-vm-tools-nox11} PROVIDES=${PROVIDES:-} REPLACES=${REPLACES:-addon-context} CONFLICTS=${CONFLICTS:-${REPLACES} one-context-ec2} - POSTIN=${POSTINST:-pkg/postinstall.freebsd} + POSTIN=${POSTINST:-pkg/postinstall} PREUN=${PREUN:-} POSTUN=${POSTUN:-} POSTUP=${POSTUP:-}