summaryrefslogtreecommitdiffstats
path: root/firstaidkit-qs
blob: d2c8b14282e268433288cc2d06c9fbfa1ae31a81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

function pause()
{
  echo "Press enter to continue"
  read a
}

if [ "$DISPLAY" == "" ]; then
  DIALOG="dialog"
else
  DIALOG="xdialog"
fi

OPTION=""
TMPFILE="/tmp/$0-$$.item"
MENU="\
shell Start shell\
fakd Run diagnostic\
reboot Reboot\
"

WIDTH="30"
HEIGHT="12"
MENUHEIGHT="8"

while [ "x$OPTION" != "x" ]; do
  $DIALOG --menu $HEIGHT $WIDTH $MENUHEIGHT $MENU 2>$TMPFILE
  OPTION=$(cat $TMPFILE)

  if [ "x$OPTION" == "xshell" ]; then
    echo "Starting shell..."
    bash
  elif [ "x$OPTION" == "xfakd" ]; then
    echo "Running diagnostic..."
    firstaidkit -a
    pause
  elif [ "x$OPTION" == "xreboot" ]; then
    reboot
  fi

done