summaryrefslogtreecommitdiff
path: root/src/lib/lib-ui.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-10-31 15:56:47 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-10-31 15:56:47 +0100
commit87ae3a5d9ad48831a91f6e49e82cd2f5e94fc549 (patch)
tree26a883210c8640f28c948f7b7f81e9bd2bcaa034 /src/lib/lib-ui.sh
parentc80cd775e93c4337d39b97bfa9d943bd5747af7b (diff)
got rid of the old libraries. new ones are taken from the arch linux installer.git project. im porting/making usable function by function, im still working on it
Diffstat (limited to 'src/lib/lib-ui.sh')
-rw-r--r--src/lib/lib-ui.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/lib/lib-ui.sh b/src/lib/lib-ui.sh
new file mode 100644
index 0000000..10ad1a1
--- /dev/null
+++ b/src/lib/lib-ui.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# DIALOG() taken from setup
+# an el-cheapo dialog wrapper
+#
+# parameters: see dialog(1)
+# returns: whatever dialog did
+DIALOG()
+{
+ dialog --backtitle "$TITLE" --aspect 15 "$@"
+ return $?
+}
+
+
+# taken from setup
+printk()
+{
+ case $1 in
+ "on") echo 4 >/proc/sys/kernel/printk ;;
+ "off") echo 0 >/proc/sys/kernel/printk ;;
+ esac
+}
+
+
+# geteditor(). taken from original setup code. prepended gui_ because power users just export $EDITOR on the cmdline.
+# prompts the user to choose an editor
+# sets EDITOR global variable
+#
+gui_geteditor() {
+ DIALOG --menu "Select a Text Editor to Use" 10 35 3 \
+ "1" "nano (easier)" \
+ "2" "vi" 2>$ANSWER
+ case $(cat $ANSWER) in
+ "1") EDITOR="nano" ;;
+ "2") EDITOR="vi" ;;
+ *) EDITOR="nano" ;;
+ esac
+}
+
+# Get a list of available disks for use in the "Available disks" dialogs. This
+# will print the disks as follows, getting size info from hdparm:
+# /dev/sda: 640133 MBytes (640 GB)
+# /dev/sdb: 640135 MBytes (640 GB)
+gui_getavaildisks()
+{
+ # NOTE: to test as non-root, stick in a 'sudo' before the hdparm call
+ for i in $(finddisks); do echo -n "$i: "; hdparm -I $i | grep -F '1000*1000' | sed "s/.*1000:[ \t]*\(.*\)/\1/"; echo "\n"; done
+}
+ \ No newline at end of file