From: Dinko Korunic Date: Wed, 27 Nov 2013 09:37:14 +0000 (+0100) Subject: - fixes as requested from Zelja X-Git-Tag: debian/3%3.2.1~1 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=kernel-cn.git;a=commitdiff_plain;h=83905fd72f3221076d08412da1d2039eeb239f36 - fixes as requested from Zelja --- diff --git a/debian/postinst b/debian/postinst index 29e424e..b14bd1f 100755 --- a/debian/postinst +++ b/debian/postinst @@ -101,6 +101,17 @@ fi ################################################################################ +# check if we are under Xen DomU PV +# (perhaps check /sys/hypervisor/uuid in the future) + +GRUB_MBR="yes" +if [ \( -w /dev/xvda \) -o \( -w /dev/xvdb \) ]; then + echo "CN: Detected DomU instance, won't install Grub MBR." + GRUB_MBR="no" +fi + +################################################################################ + # intro msg echo -n "CN: Configuring system (this will take a while):" @@ -224,10 +235,10 @@ if [ "x$GRUB2" = "xno" ]; then if [ ! -x /usr/sbin/grub ]; then echo "." echo "CN: FATAL ERROR while trying to execute GRUB1!" - echo "CN: Do not reboot your server and report this to OTRS immediately!" + echo "CN: Do not reboot your server and report this to syshelp@carnet.hr immediately!" exit 1 fi - grub --batch --no-floppy --device-map="$device_map" <<'EOF' >/dev/null 2>&1 + grub --batch --no-floppy --device-map="$device_map" <<'EOF' >/dev/null 2>&1 || true quit EOF if [ ! -s "$device_map" ]; then @@ -240,8 +251,8 @@ EOF fi else # Grub2 part - grub-mkdevicemap --no-floppy - grub-install --no-floppy --grub-setup=/bin/true "$(grub-probe -t drive /boot/grub)" >/dev/null 2>&1 + grub-mkdevicemap --no-floppy >/dev/null 2>&1 || true + grub-install --no-floppy --grub-setup=/bin/true "$(grub-probe -t drive /boot/grub)" >/dev/null 2>&1 || true fi echo -n " grub3" @@ -256,7 +267,7 @@ if [ "x$GRUB2" = "xno" ]; then if [ -z "$install_device" ]; then echo "." echo "CN: FATAL ERROR while detecting boot disk!" - echo "CN: Do not reboot your server and report this to OTRS immediately!" + echo "CN: Do not reboot your server and report this to syshelp@carnet.hr immediately!" exit 1 fi @@ -280,15 +291,16 @@ else fi echo -n " grub4" -# install GRUB loader -# this will work for both Grub1 and Grub2 -if ! grub-install --no-floppy "$install_device" >/dev/null 2>&1; then - echo "." - echo "CN: FATAL ERROR while running grub-install on $install_device!" - echo "CN: Do not reboot your server and report this to OTRS immediately!" - exit 1 +# install GRUB loader: this will work for both Grub1 and Grub2 +if [ "x$GRUB_MBR" = "xyes" ]; then + if ! grub-install --no-floppy "$install_device" >/dev/null 2>&1; then + echo "." + echo "CN: FATAL ERROR while running grub-install on $install_device!" + echo "CN: Do not reboot your server and report this to syshelp@carnet.hr immediately!" + exit 1 + fi + echo -n " grub5" fi -echo -n " grub5" # fix possible wrong params in menu.lst if [ "x$GRUB2" = "xno" ]; then @@ -333,18 +345,20 @@ fi echo -n " grub7" # install to other boot sectors if needed (better safe than sorry) -if [ "x$GRUB2" = "xyes" ]; then - # Grub2 part - db_get grub-pc/install_devices - for i in `echo $RET | sed -e 's/,/ /g'`; do - real_device="$(readlink -f "$i")" - if [ -e "$real_device" ]; then - grub-install --force --no-floppy $real_device \ - >/dev/null 2>&1 || true - fi - done +if [ "x$GRUB_MBR" = "xyes" ]; then + if [ "x$GRUB2" = "xyes" ]; then + # Grub2 part + db_get grub-pc/install_devices + for i in `echo $RET | sed -e 's/,/ /g'`; do + real_device="$(readlink -f "$i")" + if [ -e "$real_device" ]; then + grub-install --force --no-floppy $real_device \ + >/dev/null 2>&1 || true + fi + done + fi + echo -n " grub8" fi -echo -n " grub8" # disable lilo if [ -e /etc/lilo.conf ]; then @@ -405,7 +419,7 @@ rm -f /etc/sysctl.conf.$$ # old kernel params (skipping some of the obsolete or overrided entries) if [ -e /etc/sysctl.conf ]; then - egrep -v 'net\.core\.(r|w)mem_max|net\.ipv4\.tcp_(r|w)mem|vm\.bdflush|net\.ipv4\.ip_local_port_range|kernel\.rtsig-max|net\.ipv4\.tcp_syncookies|kernel\.exec-shield|net\.ipv4\.tcp_max_syn_backlog|net\.ipv4\.tcp_congestion_control|kernel\.exec-shield|kernel\.maps_protect' \ + egrep -v 'net\.core\.(r|w)mem_max|net\.ipv4\.tcp_(r|w)mem|vm\.bdflush|net\.ipv4\.ip_local_port_range|kernel\.rtsig-max|net\.ipv4\.tcp_syncookies|kernel\.exec-shield|net\.ipv4\.tcp_max_syn_backlog|net\.ipv4\.tcp_congestion_control|kernel\.maps_protect' \ /etc/sysctl.conf >> /etc/sysctl.conf.$$ fi