9
0
Fork 0

defenv-2: replace menu with menutree

This makes the menu easier to extend and to maintain.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-09-25 07:22:23 +02:00
parent ca8edb3b65
commit 294dc7160e
29 changed files with 49 additions and 150 deletions

View File

@ -605,7 +605,7 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW
config DEFAULT_ENVIRONMENT_GENERIC_NEW_MENU
bool
depends on DEFAULT_ENVIRONMENT_GENERIC_NEW
depends on CMD_MENU_MANAGEMENT
depends on CMD_MENUTREE
default y
config DEFAULT_ENVIRONMENT_GENERIC_NEW_DFU

View File

@ -0,0 +1,5 @@
#!/bin/sh
boot
readline "Booting failed. Press any key to continue" ignore

View File

@ -0,0 +1 @@
Boot default

View File

@ -0,0 +1,3 @@
#!/bin/sh
boot -m

View File

@ -0,0 +1,5 @@
#!/bin/sh
echo "Boot from Network...."
sleep 3

View File

@ -0,0 +1 @@
Boot from network

View File

@ -0,0 +1 @@
Detect bootsources

View File

@ -0,0 +1,5 @@
#!/bin/sh
edit /env/config
/env/config

View File

@ -0,0 +1 @@
Config settings

View File

@ -0,0 +1,3 @@
#!/bin/sh
edit /env/network/eth0

View File

@ -0,0 +1 @@
Network settings

View File

@ -0,0 +1 @@
Settings

View File

@ -0,0 +1,8 @@
#!/bin/sh
saveenv
if [ $? != 0 ]; then
echo "saving environment failed"
fi
sleep 2

View File

@ -0,0 +1 @@
Save environment

View File

@ -0,0 +1,5 @@
#!/bin/sh
echo "Enter 'exit' to get back to the menu"
sh

View File

@ -0,0 +1 @@
Shell

View File

@ -0,0 +1,3 @@
#!/bin/sh
reset

View File

@ -0,0 +1 @@
Reset

View File

@ -1,13 +0,0 @@
#!/bin/sh
cd /env/boot
./$global.boot.default menu
for i in *; do
if [ "$i" != "$global.boot.default" ]; then
./$i menu
fi
done
cd /

View File

@ -1,20 +0,0 @@
#!/bin/sh
export menu_exit=false
while true; do
menu -a -m boot_entries_edit -d "\e[1;36mEdit boot entries\e[0m"
boot-entries-collect
menu -e -a -m boot_entries_edit -c "boot-menu-new-boot-entry" -d "Add a new entry"
menu -e -a -m boot_entries_edit -c "boot-entries-remove" -d "Remove an entry"
menu -e -a -m boot_entries_edit -c "menu_exit=true" -d "back"
menu -s -m boot_entries_edit
menu -r -m boot_entries_edit
if [ $menu_exit = true ]; then
exit
fi
done

View File

@ -1,18 +0,0 @@
#!/bin/sh
export menu_exit=false
while true; do
menu -a -m boot_entries_remove -d "\e[1;36mRemove Boot entry\e[0m"
boot-entries-collect
menu -e -a -m boot_entries_remove -c "menu_exit=true" -d "back"
menu -s -m boot_entries_remove
menu -r -m boot_entries_remove
if [ $menu_exit = true ]; then
exit
fi
done

View File

@ -1,5 +0,0 @@
#!/bin/sh
menu -e -a -m boot -c "boot -v $1; echo; readline \"press enter to continue\" a " -d "Boot: ${GREEN}$2${NC}"
menu -e -a -m boot_entries_edit -c "$global.editcmd /env/boot/$1" -d "${GREEN}$2${NC}"
menu -e -a -m boot_entries_remove -c "rm /env/boot/$1" -d "${GREEN}$2${NC}"

View File

@ -1,21 +0,0 @@
#!/bin/sh
name=
readline "Name of the new entry: " name
if [ -z "$name" ]; then
exit 1
fi
if [ -e "/env/boot/$name" ]; then
echo "entry $name already exists"
readline "<enter>" unused
exit 1
fi
cp /env/data/boot-template /env/boot/$name
edit /env/boot/$name
boot-menu-show rebuild

View File

@ -1,9 +0,0 @@
#!/bin/sh
cd /env/init
for i in *; do
./$i menu
done
cd /

View File

@ -1,20 +0,0 @@
#!/bin/sh
export menu_exit=false
while true; do
menu -a -m init_entries_edit -d "\e[1;36mEdit init entries\e[0m"
menu -e -a -m init_entries_edit -R -c "true" -d ">> Reset board to let changes here take effect <<"
init-entries-collect
menu -e -a -m init_entries_edit -c "menu_exit=true" -d "back"
menu -s -m init_entries_edit
menu -r -m init_entries_edit
if [ $menu_exit = true ]; then
exit
fi
done

View File

@ -1,3 +0,0 @@
#!/bin/sh
menu -e -a -m init_entries_edit -c "$global.editcmd /env/init/$1" -d "\e[1;32m$2\e[0m"

View File

@ -1,23 +1,5 @@
#!/bin/sh
savepath=$PATH
export menupath=$PATH:/env/menu
. /env/data/ansi-colors
while true; do
export PATH=${menupath}
echo $PATH
menu -a -m boot -d "${CYAN}Welcome to Barebox${NC}"
boot-entries-collect
menu -e -a -m boot -c "settings" -d "Settings"
menu -e -a -m boot -c 'PATH=$savepath; echo "enter exit to return to menu"; sh' -d "${DARK_YELLOW}Shell${NC}"
menu -e -a -m boot -c reset -d "${RED}Reset${NC}"
menu -s -m boot
menu -r -m boot
done
menutree

View File

@ -1,21 +0,0 @@
#!/bin/sh
export menu_exit=false
while true; do
menu -a -m settings -d "${CYAN}Settings${NC}"
menu -e -a -R -m settings -c "$global.editcmd /env/network/eth0" -d "Network settings"
menu -e -a -R -m settings -c "$global.editcmd /env/config" -d "Config settings"
menu -e -a -m settings -c "boot-entries-edit" -d "Edit boot entries"
menu -e -a -m settings -c "init-entries-edit" -d "Edit init entries"
menu -e -a -R -m settings -c "saveenv || echo \"failed to save environment\" && sleep 2" -d "Save settings"
menu -e -a -m settings -c "menu_exit=true" -d "back"
menu -s -m settings
menu -r -m settings
if [ $menu_exit = true ]; then
exit
fi
done

View File

@ -0,0 +1 @@
${RED}Main menu${NC}