Use the init scripts from the glean package

The init scripts have now been moved in to glean itself, so just consume
them directly.

Change-Id: Ib85128579c62020df23d73404c0563894038d2dd
Depends-On: I2ed25ce434023bfc8b6a88a08c0c06c1cef63982
This commit is contained in:
Monty Taylor 2015-06-27 12:51:25 -04:00
parent 96c134b429
commit 1603aa2457
6 changed files with 1 additions and 126 deletions

View File

@ -21,14 +21,4 @@ set -o pipefail
SCRIPTDIR=$(dirname $0)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/simple-init.sh /usr/local/sbin/simple-init.sh
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/simple-init.conf /etc/init/simple-init.conf
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/simple-init@.service /usr/lib/systemd/system/simple-init@.service
install -D -g root -o root -m 0644 ${SCRIPTDIR}/simple-init-udev.rules /etc/udev/rules.d/99-simple-init.rules
elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/simple-init.init /etc/init.d/simple-init
update-rc.d simple-init defaults
fi
glean-install

View File

@ -1 +0,0 @@
SUBSYSTEM=="net", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="simple-init@$name.service"

View File

@ -1,15 +0,0 @@
# Call a script to generate a /etc/network/interfaces file to DHCP all available interfaces
# Then remove this config file so the script is never run again
description "Run glean to configure network interfaces"
# console output connects stdout/stderr to the console log. This is important
# for debuggability of cloud images that wind up not booting
console output
start on starting network-interface
instance $INTERFACE
task
exec /usr/local/sbin/simple-init.sh $INTERFACE

View File

@ -1,31 +0,0 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: simple-init
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# X-Start-Before: networking
# Short-Description: Autodetect network interfaces
# Description: Autodetect network interfaces during boot and configure them for DHCP
### END INIT INFO
NAME=simple-init
INIT_NAME=/etc/init.d/${NAME}
SCRIPT_NAME=/usr/local/sbin/${NAME}.sh
[ -x $SCRIPT_NAME ] || exit 0
case "$1" in
start)
$SCRIPT_NAME
;;
stop)
;;
*)
echo "Usage: $INIT_NAME {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -1,53 +0,0 @@
#!/bin/bash
# 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.
# dib-lint: disable=dibdebugtrace
set -eu
set -o pipefail
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
INTERFACE=${1:-} #optional, if not specified configure all available interfaces
function config_exists() {
local interface=$1
if [ "$CONF_TYPE" == "netscripts" ]; then
if [ -f "/etc/sysconfig/network-scripts/ifcfg-$interface" ]; then
return 0
fi
else
ifquery $interface >/dev/null 2>&1 && return 0 || return 1
fi
return 1
}
# Test to see if config-drive exists. If not, skip and assume DHCP networking
# will work becasue sanity
if blkid -t LABEL="config-2" ; then
# Mount config drive
mkdir -p /mnt/config
mount -o mode=0700 $(blkid -t LABEL="config-2" | cut -d ':' -f 1) /mnt/config || true
glean --ssh --skip-network --hostname
fi
if [ -f /usr/bin/dpkg ] ; then
test -f /etc/ssh/ssh_host_rsa_key || dpkg-reconfigure openssh-server
fi
if [ -n "$INTERFACE" ]; then
glean --interface $INTERFACE
else
glean
fi

View File

@ -1,15 +0,0 @@
[Unit]
Description=DHCP interface %I
After=network.service network.target
ConditionPathExists=!/etc/sysconfig/network-scripts/ifcfg-%I
[Service]
Type=oneshot
User=root
ExecStartPre=/usr/local/sbin/simple-init.sh %I
ExecStart=/sbin/ifup %I
RemainAfterExit=true
[Install]
WantedBy=multi-user.target