################################################################################
+# 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):"
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
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"
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
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
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
# 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