Import systemd's script from Fedora's image and install NetworkManager.
This commit is contained in:
parent
21b5ddacfd
commit
deb9a1aad1
|
@ -21,7 +21,8 @@ RUN pacman -Sy --noconfirm \
|
|||
ntp \
|
||||
openssh \
|
||||
vim \
|
||||
wget
|
||||
wget \
|
||||
networkmanager
|
||||
|
||||
|
||||
# Locales
|
||||
|
@ -38,6 +39,7 @@ RUN systemctl enable sshd.service \
|
|||
# Patch rootfs
|
||||
RUN wget -qO - http://j.mp/ocs-scripts | bash
|
||||
ADD ./patches/etc/ /etc/
|
||||
ADD ./patches/usr/ /usr/
|
||||
|
||||
|
||||
# packages upgrade
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Reboot
|
||||
Documentation=man:systemd-halt.service(8)
|
||||
DefaultDependencies=no
|
||||
Requires=shutdown.target umount.target final.target
|
||||
After=shutdown.target umount.target final.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/oc-nbd-disconnect-root
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
METADATA_CACHE=`mktemp -u`
|
||||
|
||||
get_metadata() {
|
||||
if [ ! -f $METADATA_CACHE ]; then
|
||||
/usr/local/bin/oc-metadata > $METADATA_CACHE
|
||||
fi
|
||||
}
|
||||
|
||||
get_value() {
|
||||
# Get value from metadata
|
||||
key="$1"
|
||||
grep "^$key=" "$METADATA_CACHE" | cut -d= -f2 | sed "s/^['\"]//;s/['\"]$//"
|
||||
}
|
||||
|
||||
add_volumes() {
|
||||
keys=$(get_value VOLUMES)
|
||||
for key in $keys
|
||||
do
|
||||
test $key -eq 0 && continue
|
||||
host=$(get_value VOLUMES_${key}_EXPORT_URI | sed 's|nbd://\(.*\):.*|\1|')
|
||||
port=$(get_value VOLUMES_${key}_EXPORT_URI | sed 's|nbd://.*:\(.*\)|\1|')
|
||||
device=/dev/nbd$key
|
||||
xnbd-client -c $device && continue
|
||||
for i in {1..3}
|
||||
do
|
||||
xnbd-client --connect $device $host $port --blocksize 4096 && break
|
||||
sleep 5
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
get_metadata
|
||||
add_volumes
|
||||
rm $METADATA_CACHE
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# Thanks to the LTSP project
|
||||
# If the root /dev/nbd0 device is unmounted on reboot then nbd read
|
||||
# errors occur, and if it isn't, then # the nbd-server process on the server
|
||||
# doesn't terminate.
|
||||
# Called by init scripts on reboot.
|
||||
|
||||
NBD_CLIENT=/usr/local/sbin/xnbd-client
|
||||
|
||||
disconnect() {
|
||||
$NBD_CLIENT -d "/dev/nbd0"
|
||||
echo b > /proc/sysrq-trigger
|
||||
}
|
||||
|
||||
disconnect
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
ROOT_DEVICE="/dev/nbd0"
|
||||
|
||||
umount_nbd_devices() {
|
||||
for device in $(mount | cut -d " " -f 1 | grep /dev/nbd)
|
||||
do
|
||||
test $device = $ROOT_DEVICE && continue
|
||||
umount $device 2>/dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
echo -n "umount of $device failed! Data loss may occur! will continue in 10 seconds..."
|
||||
sleep 1
|
||||
for i in 9 8 7 6 5 4 3 2 1
|
||||
do
|
||||
echo -n $i" "
|
||||
sleep 1
|
||||
done
|
||||
echo "ok, going on..."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
swapoff_nbd_devices() {
|
||||
for device in $(grep '^/dev/nb' /proc/swaps | cut -d ' ' -f1)
|
||||
do
|
||||
swapoff $device 2> /dev/null
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
disconnect_devices() {
|
||||
for device in $(ls /dev/nbd*)
|
||||
do
|
||||
test $device = $ROOT_DEVICE && continue
|
||||
if xnbd-client -c $device 2> /dev/null
|
||||
then
|
||||
xnbd-client -d $device
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
umount_nbd_devices
|
||||
swapoff_nbd_devices
|
||||
disconnect_devices
|
Loading…
Reference in New Issue