improve some other setuptool
[cmdllinux.git] / scripts / setup / installgrub.old
blob34e6f662343d45a6335a2f720594709140fb0cfa
1 #! /bin/sh
3 : ${DIALOG=dialog}
5 tempfile=`mktemp 2> /dev/null` || tempfile=/tmp/test$$
6 trap "rm -f $tempfile" 0 1 2 5 15
8 lsdev()
10 test -L /sys/block/$(ls /sys/block | head -n 1) && \
11     find /sys/devices -path "*/block/*" \( -name "sd[a-z]*" -o -name "ub[a-z]*" \) || \
12     find /sys/block \( -name "sd[a-z]*" -o -name "ub[a-z]*" \)
15 lsblk()
17     lsdev | \
18     while read DEV; do
19         [ -f $DEV/dev ] || continue
20         echo "/dev/${DEV##*/}"
21     done
24 $DIALOG --backtitle "Configuring system settings" \
25         --title "" --clear \
26         --menu "Install boot loader on device" 20 61 15 \
27         `lsblk | sort | sed "s/.*/& </"` 2> $tempfile
29 retval=$?
31 choice=`cat $tempfile`
32 case $retval in
33     0)
34         [ ! -z "$choice" ] && grub-install $choice
35     ;;
36 esac