Skip to content

Commit

Permalink
changes to suse dracut generation
Browse files Browse the repository at this point in the history
remove duplicate drive busy check
  • Loading branch information
asciiprod committed Apr 21, 2015
1 parent 9e62021 commit fb8e9f8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
Empty file modified README
100755 → 100644
Empty file.
12 changes: 6 additions & 6 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,11 @@ validate_vars() {
fi

# test if $DRIVE1 is not busy
CHECK="$(hdparm -z $DRIVE1 2>&1 | grep 'BLKRRPART failed: Device or resource busy')"
if [ "$CHECK" ]; then
graph_error "ERROR: DRIVE1 is busy - cannot access device $DRIVE1 "
return 1
fi
# CHECK="$(hdparm -z $DRIVE1 2>&1 | grep 'BLKRRPART failed: Device or resource busy')"
# if [ "$CHECK" ]; then
# graph_error "ERROR: DRIVE1 is busy ($CHECK) - cannot access device $DRIVE1 "
# return 1
# fi

# test if $SWRAID has not 0 or 1 as parameter
if [ "$SWRAID" != "0" -a "$SWRAID" != "1" ]; then
Expand Down Expand Up @@ -3540,7 +3540,7 @@ function isVServer() {
*)
debug "# Systype: $SYSTYPE"
case "$SYSMFC" in
QEMU)
QEMU)
debug "# Manufacturer: $SYSMFC"
return 0;;
*)
Expand Down
42 changes: 29 additions & 13 deletions suse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ generate_config_mdadm() {
echo "DEVICES /dev/[hs]d*" > $FOLD/hdd$MDADMCONF
echo "MAILADDR root" >> $FOLD/hdd$MDADMCONF
if [ "$SUSEVERSION" -ge 132 ] ; then
echo > $FOLD/hdd$MDADMCONF
echo >> $FOLD/hdd$MDADMCONF
fi
# if [ "$SUSEVERSION" = "11.0" -o "$SUSEVERSION" = "11.2" -o "$SUSEVERSION" = "11.3" -o "$SUSEVERSION" = "11.4" -o "$SUSEVERSION" = "12.1" -o "$SUSEVERSION" = "12.2" ]; then
if [ "$SUSEVERSION" -ge 110 ]; then
Expand All @@ -102,18 +102,18 @@ generate_new_ramdisk() {
# opensuse 13.2 uses dracut for generating initrd
if [ "$SUSEVERSION" -ge 132 ] ; then
DRACUTFILE="$FOLD/hdd/etc/dracut.conf.d/03-hetzner.conf"
echo "add_dracutmodules+=\"mdraid lvm\"" >> $DRACUTFILE
echo "add_drivers+=\"raid1 raid10 raid0 raid456\"" >> $DRACUTFILE
echo "mdadmconf=\"yes\"" >> $DRACUTFILE
echo "lvmconf=\"yes\"" >> $DRACUTFILE
echo "hostonly=\"no\"" >> $DRACUTFILE
echo "early_microcode=\"no\"" >> $DRACUTFILE

# echo "add_dracutmodules+=\"mdraid lvm\"" >> $DRACUTFILE
# echo "add_drivers+=\"raid1 raid10 raid0 raid456\"" >> $DRACUTFILE
# echo "mdadmconf=\"yes\"" >> $DRACUTFILE
# echo "lvmconf=\"yes\"" >> $DRACUTFILE
# echo "hostonly=\"no\"" >> $DRACUTFILE
# echo "early_microcode=\"no\"" >> $DRACUTFILE
#
# dracut fix for auto-assembling raid
local mdraid_rule="$FOLD/hdd/usr/lib/udev/rules.d/64-md-raid-assembly.rules"
local dracut_rulesd="$FOLD/hdd/usr/lib/dracut/rules.d"
mkdir -p $dracut_rulesd
cp $mdraid_rule $dracut_rulesd
# local mdraid_rule="$FOLD/hdd/usr/lib/udev/rules.d/64-md-raid-assembly.rules"
# local dracut_rulesd="$FOLD/hdd/usr/lib/dracut/rules.d"
# mkdir -p $dracut_rulesd
# cp $mdraid_rule $dracut_rulesd
else
KERNELCONF="$FOLD/hdd/etc/sysconfig/kernel"

Expand All @@ -131,14 +131,30 @@ generate_new_ramdisk() {
echo -e "### especially in combination with nomodeset" >> $blacklist_conf
echo -e "blacklist i915" >> $blacklist_conf

local dracut_feature=''
local dracut_modules=''
if [ "$SWRAID" = "1" ]; then
dracut_feature="$dracut_feature mdraid"
dracut_modules="$dracut_modules raid0 raid1 raid10 raid456"
fi
[ "$LVM" = "1" ] && dracut_feature="$dracut_feature lvm"


# change the if contruct to test
if [ "$SUSEVERSION" -ge 112 ]; then
# mkinitrd doesn't have the switch -t anymore as of 11.2 and uses /dev/shm if it is writeable
if [ "$SUSEVERSION" -ge 121 ]; then
# run without updating bootloader as this would fail because of missing
# or at this point still wrong device.map.
# A device.map is temp. generated by grub2-install in 12.2
execute_chroot_command "mkinitrd -B"; EXITCODE=$?
mkinitcmd="mkinitrd -B"
if [ "$SUSEVERSION" -ge 132 ]; then
[ -n "$dracut_feature" ] && mkinitcmd="$mkinitcmd -f '$dracut_feature'"
[ -n "$dracut_modules" ] && mkinitcmd="$mkinitcmd -m '$dracut_modules'"
execute_chroot_command "$mkinitcmd"; EXITCODE=$?
else
execute_chroot_command "$mkinitcmd"; EXITCODE=$?
fi
else
execute_chroot_command "mkinitrd"; EXITCODE=$?
fi
Expand Down

0 comments on commit fb8e9f8

Please sign in to comment.