Merge "Add fedora support for ramdisk-image-create."
This commit is contained in:
commit
8532b3d7ad
15
elements/deploy/root.d/50-redhat-prepare-fs
Executable file
15
elements/deploy/root.d/50-redhat-prepare-fs
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
[ -n "$TARGET_ROOT" ]
|
||||||
|
|
||||||
|
DISTRO=`lsb_release -si` || true
|
||||||
|
|
||||||
|
if [[ "Fedora RedHatEnterpriseServer" =~ "$DISTRO" ]]; then
|
||||||
|
mkdir -p "$TARGET_ROOT/usr"
|
||||||
|
ln -s ../lib "$TARGET_ROOT/usr/lib"
|
||||||
|
if [ "`uname -m`" = "x86_64" ]; then
|
||||||
|
ln -s lib "$TARGET_ROOT/lib64"
|
||||||
|
fi
|
||||||
|
fi
|
@ -52,7 +52,7 @@ function save_image () {
|
|||||||
|
|
||||||
function generate_hooks () {
|
function generate_hooks () {
|
||||||
mkdir -p $TMP_HOOKS_PATH
|
mkdir -p $TMP_HOOKS_PATH
|
||||||
for _ELEMENT in $IMAGE_ELEMENT ; do
|
for _ELEMENT in $IMAGE_ELEMENT $RAMDISK_ELEMENT ; do
|
||||||
for dir in $(echo $ELEMENTS_PATH | tr ":" " ") ; do
|
for dir in $(echo $ELEMENTS_PATH | tr ":" " ") ; do
|
||||||
[ -d $dir/$_ELEMENT ] || continue
|
[ -d $dir/$_ELEMENT ] || continue
|
||||||
cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ;
|
cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ;
|
||||||
|
@ -68,11 +68,14 @@ function create_base () {
|
|||||||
# cjk adding for discovery support
|
# cjk adding for discovery support
|
||||||
mkdir -p "$TMP_MOUNT_PATH/var/lib/dhcp"
|
mkdir -p "$TMP_MOUNT_PATH/var/lib/dhcp"
|
||||||
mkdir -p "$TMP_MOUNT_PATH/var/run"
|
mkdir -p "$TMP_MOUNT_PATH/var/run"
|
||||||
|
|
||||||
mkdir -p "$TMP_MOUNT_PATH/lib/udev/rules.d"
|
mkdir -p "$TMP_MOUNT_PATH/lib/udev/rules.d"
|
||||||
cp -a "$LIB_UDEV/rules.d/50-firmware.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d"
|
cp -a "$LIB_UDEV/rules.d/50-firmware.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d"
|
||||||
cp -a "$LIB_UDEV/rules.d/80-drivers.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d"
|
cp -a "$LIB_UDEV/rules.d/80-drivers.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d"
|
||||||
cp -a "$LIB_UDEV/firmware" "$TMP_MOUNT_PATH/lib/udev"
|
|
||||||
|
if [ -a $LIB_UDEV/firmware ]; then
|
||||||
|
cp -a "$LIB_UDEV/firmware" "$TMP_MOUNT_PATH/lib/udev"
|
||||||
|
fi
|
||||||
|
|
||||||
# cjk adding for hwdiscovery support
|
# cjk adding for hwdiscovery support
|
||||||
cp "/sbin/dhclient-script" "$TMP_MOUNT_PATH/sbin"
|
cp "/sbin/dhclient-script" "$TMP_MOUNT_PATH/sbin"
|
||||||
|
|
||||||
@ -89,6 +92,9 @@ udev_root="/dev"
|
|||||||
udev_rules="/lib/udev/rules.d"
|
udev_rules="/lib/udev/rules.d"
|
||||||
udev_log="no"
|
udev_log="no"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
generate_hooks
|
||||||
|
TARGET_ROOT=$TMP_MOUNT_PATH run_d root
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_required_libs() {
|
function copy_required_libs() {
|
||||||
@ -140,7 +146,25 @@ function copy_required_libs() {
|
|||||||
function populate_lib () {
|
function populate_lib () {
|
||||||
echo "Populating /lib"
|
echo "Populating /lib"
|
||||||
|
|
||||||
for i in "$BUSYBOX" "$LIB_UDEV/firmware" bash lsmod modprobe udevd udevadm wget reboot shutdown $BINARY_DEPS ; do
|
# find udevd
|
||||||
|
UDEVD=
|
||||||
|
for f in /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd \
|
||||||
|
/usr/lib/systemd/systemd-udevd \
|
||||||
|
/usr/lib/udev/udevd; do
|
||||||
|
if [ -x "$f" ]; then
|
||||||
|
UDEVD="$f"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
UDEV_FIRMWARE=
|
||||||
|
if [ -a $LIB_UDEV/firmware ]; then
|
||||||
|
UDEV_FIRMWARE="$LIB_UDEV/firmware"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in "$BUSYBOX" bash lsmod modprobe udevadm \
|
||||||
|
wget reboot shutdown $UDEVD $UDEV_FIRMWARE \
|
||||||
|
$BINARY_DEPS ; do
|
||||||
if "$BUSYBOX" --list | grep "^$i\$" >/dev/null; then
|
if "$BUSYBOX" --list | grep "^$i\$" >/dev/null; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
60
scripts/init
60
scripts/init
@ -49,27 +49,43 @@ readonly DEPLOYMENT_KEY=$(get_kernel_parameter deployment_key)
|
|||||||
readonly ISCSI_TARGET_IQN=$(get_kernel_parameter iscsi_target_iqn)
|
readonly ISCSI_TARGET_IQN=$(get_kernel_parameter iscsi_target_iqn)
|
||||||
|
|
||||||
mount -t sysfs none /sys
|
mount -t sysfs none /sys
|
||||||
mount -t tmpfs none /dev
|
|
||||||
ln -sf /proc/self/fd /dev/fd
|
UDEVD=
|
||||||
mknod /dev/null c 1 3
|
if [ -x "/bin/systemd-udevd" ]; then
|
||||||
mknod /dev/zero c 1 5
|
UDEVD="systemd-udevd"
|
||||||
mknod /dev/random c 1 8
|
else
|
||||||
mknod /dev/urandom c 1 9
|
UDEVD="udevd"
|
||||||
mknod /dev/tty0 c 4 0
|
fi
|
||||||
mknod /dev/tty1 c 4 1
|
|
||||||
mknod /dev/tty2 c 4 2
|
if [ "$UDEVD" = "systemd-udevd" ]; then
|
||||||
mknod /dev/tty3 c 4 3
|
# devtmpfs is required since udev 176
|
||||||
mknod /dev/tty4 c 4 4
|
mount -t devtmpfs none /dev
|
||||||
mknod /dev/tty5 c 4 5
|
mkdir -p /run
|
||||||
mknod /dev/tty6 c 4 6
|
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
|
||||||
mknod /dev/tty7 c 4 7
|
mkdir -p /run/lock
|
||||||
mknod /dev/tty8 c 4 8
|
else
|
||||||
mknod /dev/tty9 c 4 9
|
mount -t tmpfs none /dev
|
||||||
mknod /dev/tty c 5 0
|
ln -sf /proc/self/fd /dev/fd
|
||||||
mknod -m 0600 /dev/console c 5 1
|
mknod /dev/null c 1 3
|
||||||
mknod -m 0666 /dev/ptmx c 5 2
|
mknod /dev/zero c 1 5
|
||||||
mkdir -p /dev/.udev
|
mknod /dev/random c 1 8
|
||||||
mkdir -p /dev/.udev/data
|
mknod /dev/urandom c 1 9
|
||||||
|
mknod /dev/tty0 c 4 0
|
||||||
|
mknod /dev/tty1 c 4 1
|
||||||
|
mknod /dev/tty2 c 4 2
|
||||||
|
mknod /dev/tty3 c 4 3
|
||||||
|
mknod /dev/tty4 c 4 4
|
||||||
|
mknod /dev/tty5 c 4 5
|
||||||
|
mknod /dev/tty6 c 4 6
|
||||||
|
mknod /dev/tty7 c 4 7
|
||||||
|
mknod /dev/tty8 c 4 8
|
||||||
|
mknod /dev/tty9 c 4 9
|
||||||
|
mknod /dev/tty c 5 0
|
||||||
|
mknod -m 0600 /dev/console c 5 1
|
||||||
|
mknod -m 0666 /dev/ptmx c 5 2
|
||||||
|
mkdir -p /dev/.udev
|
||||||
|
mkdir -p /dev/.udev/data
|
||||||
|
fi
|
||||||
|
|
||||||
echo "starting syslogd"
|
echo "starting syslogd"
|
||||||
|
|
||||||
@ -78,7 +94,7 @@ syslogd
|
|||||||
klogd
|
klogd
|
||||||
|
|
||||||
echo "starting udevd"
|
echo "starting udevd"
|
||||||
udevd --daemon --resolve-names=never
|
$UDEVD --daemon --resolve-names=never
|
||||||
|
|
||||||
echo "load modules"
|
echo "load modules"
|
||||||
load_modules_by_udev
|
load_modules_by_udev
|
||||||
|
Loading…
Reference in New Issue
Block a user