installer: fix for using busybox's ash shell

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-02-20 13:19:59 +01:00
parent ac57c41530
commit 7ac06939e6

View File

@ -52,7 +52,7 @@
[ -f /etc/installer.conf ] && . /etc/installer.conf || exit 0 [ -f /etc/installer.conf ] && . /etc/installer.conf || exit 0
function dbglg() { dbglg() {
# Acts just like echo cmd, with automatic redirection # Acts just like echo cmd, with automatic redirection
echo "" >> $LOGFILE echo "" >> $LOGFILE
@ -62,7 +62,7 @@ function dbglg() {
echo "" >> $LOGFILE echo "" >> $LOGFILE
} }
function get_device_unmount() { get_device_unmount() {
# get all unmounted devices # get all unmounted devices
# usage: get_devices_unmount # usage: get_devices_unmount
# uses: - # uses: -
@ -76,7 +76,7 @@ function get_device_unmount() {
done done
} }
function get_partition() { get_partition() {
# get all partitions of an specifed device # get all partitions of an specifed device
# usage: get_partitions /dev/sda # usage: get_partitions /dev/sda
# uses: - # uses: -
@ -85,7 +85,7 @@ function get_partition() {
PARTITIONS=$(parted -m $1 print |grep -v ^/dev |grep -v BYT | cut -f1 -d ":") PARTITIONS=$(parted -m $1 print |grep -v ^/dev |grep -v BYT | cut -f1 -d ":")
} }
function create_device_list() { create_device_list() {
# create devices list for menu # create devices list for menu
# usage: create_devices_list # usage: create_devices_list
# uses: get_device_unmount # uses: get_device_unmount
@ -111,7 +111,7 @@ function create_device_list() {
done done
} }
function create_partition_list() { create_partition_list() {
# get an overview of all partitions of an specifed device # get an overview of all partitions of an specifed device
# usage: get_partition_list /dev/sda # usage: get_partition_list /dev/sda
# uses: get_partition # uses: get_partition
@ -133,7 +133,7 @@ function create_partition_list() {
done done
} }
function do_install_mbr() { do_install_mbr() {
# show menu # show menu
MSG_TITLE="\Z4[ (RE)INSTALL MBR ]\Zn" MSG_TITLE="\Z4[ (RE)INSTALL MBR ]\Zn"
@ -149,7 +149,7 @@ function do_install_mbr() {
# now we must do anything # now we must do anything
case $? in case $? in
0) 0)
INSTALL_DEVICE=$(< "$TMPDIR/device_for_install" ) INSTALL_DEVICE=$(cat "$TMPDIR/device_for_install" )
# installing mbr # installing mbr
cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE
@ -165,7 +165,7 @@ function do_install_mbr() {
esac esac
} }
function do_install_quick() { do_install_quick() {
# show menu # show menu
MSG_TITLE="\Z4[ QUICK INSTALL MENU ]\Zn" MSG_TITLE="\Z4[ QUICK INSTALL MENU ]\Zn"
@ -181,7 +181,7 @@ function do_install_quick() {
# now we must do anything # now we must do anything
case $? in case $? in
0) 0)
INSTALL_DEVICE=$(< "$TMPDIR/device_for_install" ) INSTALL_DEVICE=$(cat "$TMPDIR/device_for_install" )
# remove all partitions # remove all partitions
msg_progress_install "1" "get all partitions $INSTALL_DEVICE" msg_progress_install "1" "get all partitions $INSTALL_DEVICE"
@ -270,7 +270,7 @@ function do_install_quick() {
esac esac
} }
function msg_not_implemented() { msg_not_implemented() {
# show an dialog that this function is not yet implemented # show an dialog that this function is not yet implemented
MSG_TITLE="\Z2[ WORK IN PROGRESS ]\Zn" MSG_TITLE="\Z2[ WORK IN PROGRESS ]\Zn"
MSG_INFOBOX=" This function is not yet implemented \n stay tuned!!!" MSG_INFOBOX=" This function is not yet implemented \n stay tuned!!!"
@ -278,7 +278,7 @@ function msg_not_implemented() {
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70 dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70
} }
function msg_oem_only() { msg_oem_only() {
# show an dialog that this function is only implemented on special builds # show an dialog that this function is only implemented on special builds
MSG_TITLE="\Z2[ FOR OEM ONLY ]\Zn" MSG_TITLE="\Z2[ FOR OEM ONLY ]\Zn"
MSG_INFOBOX=" OEM only feature, this function is not implemented in this build! \n if you have questions about this feature \n visit http://www.openelec.tv!!!" MSG_INFOBOX=" OEM only feature, this function is not implemented in this build! \n if you have questions about this feature \n visit http://www.openelec.tv!!!"
@ -286,7 +286,7 @@ function msg_oem_only() {
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70 dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70
} }
function msg_warning_beta() { msg_warning_beta() {
# show an warning dialog if we use beta software # show an warning dialog if we use beta software
MSG_TITLE="\Z1[ BETA WARNING ]\Zn" MSG_TITLE="\Z1[ BETA WARNING ]\Zn"
MSG_INFOBOX=" This installer is Beta \n use it on your own risk!!! \n Please make first an backup !" MSG_INFOBOX=" This installer is Beta \n use it on your own risk!!! \n Please make first an backup !"
@ -294,7 +294,7 @@ function msg_warning_beta() {
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70 dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70
} }
function msg_no_device() { msg_no_device() {
# show an warning dialog if we dont find not mounted devices for install and return to main menu # show an warning dialog if we dont find not mounted devices for install and return to main menu
MSG_TITLE="\Z1[ INFORMATION ]\Zn" MSG_TITLE="\Z1[ INFORMATION ]\Zn"
MSG_INFOBOX=" Not found any devices to install. \n be sure you have connected your device via USB or (e)SATA. \n Please try again !" MSG_INFOBOX=" Not found any devices to install. \n be sure you have connected your device via USB or (e)SATA. \n Please try again !"
@ -304,7 +304,7 @@ function msg_no_device() {
menu_main menu_main
} }
function msg_install_ready() { msg_install_ready() {
# show an dialog that we have installed # show an dialog that we have installed
MSG_TITLE="\Z1[ INFORMATION ]\Zn" MSG_TITLE="\Z1[ INFORMATION ]\Zn"
@ -313,7 +313,7 @@ function msg_install_ready() {
menu_main menu_main
} }
function msg_progress_install() { msg_progress_install() {
# show the progress dialog # show the progress dialog
MSG_TITLE="\Z1[ INSTALLING ]\Zn" MSG_TITLE="\Z1[ INSTALLING ]\Zn"
@ -321,7 +321,7 @@ function msg_progress_install() {
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --gauge "$2 ..." 6 70 $1 & dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --gauge "$2 ..." 6 70 $1 &
} }
function menu_main() { menu_main() {
# show the mainmenu # show the mainmenu
MSG_TITLE="\Z4[ MAIN MENU ]\Zn" MSG_TITLE="\Z4[ MAIN MENU ]\Zn"
MSG_MENU="\n\ZbQuick Install:\Zn do an default installation on an specific devices, \ MSG_MENU="\n\ZbQuick Install:\Zn do an default installation on an specific devices, \
@ -344,7 +344,7 @@ function menu_main() {
case $? in case $? in
0) 0)
ITEM_MAINMENU=$(< "$TMPDIR/mainmenu" ) ITEM_MAINMENU=$(cat "$TMPDIR/mainmenu" )
case $ITEM_MAINMENU in case $ITEM_MAINMENU in
1) do_install_quick; break;; 1) do_install_quick; break;;
2) menu_custom; break;; 2) menu_custom; break;;
@ -362,13 +362,13 @@ function menu_main() {
esac esac
} }
function menu_setup() { menu_setup() {
# TODO: show the setupmenu # TODO: show the setupmenu
msg_not_implemented msg_not_implemented
menu_main menu_main
} }
function menu_bios() { menu_bios() {
# show the biosmenu # show the biosmenu
MSG_TITLE="\Z4[ BIOS MENU ]\Zn" MSG_TITLE="\Z4[ BIOS MENU ]\Zn"
MSG_MENU="\n You can use the UP/DOWN arrow keys,\n the No. of the choice as a hot key,\n to choose an option.\n\n Please choose an item:" MSG_MENU="\n You can use the UP/DOWN arrow keys,\n the No. of the choice as a hot key,\n to choose an option.\n\n Please choose an item:"
@ -382,7 +382,7 @@ function menu_bios() {
case $? in case $? in
0) 0)
ITEM_BIOSMENU=$(< "$TMPDIR/biosmenu" ) ITEM_BIOSMENU=$(cat "$TMPDIR/biosmenu" )
case $ITEM_BIOSMENU in case $ITEM_BIOSMENU in
1) bios_backup; break;; 1) bios_backup; break;;
2) bios_update; break;; 2) bios_update; break;;
@ -398,13 +398,13 @@ function menu_bios() {
esac esac
} }
function menu_custom() { menu_custom() {
# TODO: show the installmenu # TODO: show the installmenu
msg_not_implemented msg_not_implemented
menu_main menu_main
} }
function bios_backup() { bios_backup() {
# create an backup from installed bios # create an backup from installed bios
if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then
@ -424,7 +424,7 @@ function bios_backup() {
menu_bios menu_bios
} }
function bios_update() { bios_update() {
# update the bios # update the bios
if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then
@ -446,7 +446,7 @@ function bios_update() {
menu_bios menu_bios
} }
function bios_erase() { bios_erase() {
# erase the bios # erase the bios
if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then
@ -464,20 +464,20 @@ function bios_erase() {
menu_bios menu_bios
} }
function logfile_show() { logfile_show() {
# TODO: show the logfile # TODO: show the logfile
msg_not_implemented msg_not_implemented
menu_main menu_main
} }
function do_reboot() { do_reboot() {
# reboot on request # reboot on request
clear clear
sync sync
reboot reboot
} }
function do_poweroff() { do_poweroff() {
# powerdown on request # powerdown on request
clear clear
sync sync
@ -486,7 +486,7 @@ function do_poweroff() {
# setup needed variables # setup needed variables
BETA="yes" BETA="yes"
VERSION="0.2.4" VERSION="0.2.5"
BACKTITLE="OpenELEC.tv Installer $VERSION" BACKTITLE="OpenELEC.tv Installer $VERSION"
TMPDIR="/tmp/installer" TMPDIR="/tmp/installer"