Abstract New Installer
From RockWiki
0) This is a concept for the new ROCK Linux installer.
1) The installer will still be based on STONE, as is the case now.
2) The main install script is called /etc/stone.d/mod_install.sh and part of the installer packgae. The installer package has a parse-config file which installs further installation scripts. Installation scripts have the name package/<rep>/<pkg>/mod_install_<name>.sh.installer
3) Every install script must have a unique name. For the rest of this Abstract, we will use the name 'example'. The script is called package/test/example/mod_install_example.sh.installer
4) Every install script must support sub-scripts. Sub-scripts may add additional menus or menuitems, overwrite existing functions or otherwise manipulate the script. The subscript must have a unique name of the form mod_<parentscript>_<subscript>.sh.installer
5) For the rest of this Abstract, we will use the same "subexample". The script is called package/test/example2/mod_install_example_subexample.sh.installer
6) Every subscript must support further subscripts in the same way install scripts have to.
7) Install scripts must not load subscripts of subscripts.
8) Subscripts must not load subscripts of subscripts.
9) Every script should document how to manipulate its settings. This must be done either with a mod_install_<name>.sh.hlp file or with comments next to the variable declaration. This declaration must be at the top of the script and directly beneath the Copyright header.
10) The format of the mod_<name>.sh.hlp file is the same as the config.hlp file.
A practical example of the above follows:
mod_install_example.sh.installer
#!/bin/bash
# [COPY] This script is in the Public Domain
# This script is intended for demonstration only
test="foo"
# This variable holds a test string # Rule 9)
run=1
# As long as this variable is 1, the menu will be shown # Rule 9)
example_menu="gui_menu example 'Example Menu' 'Set variable to foo' 'test=\"foo\" 'Set variable to bar' 'test=\"bar\"'" # Rule 1)
# This variable the main menu in STONE format
for subscript in /etc/stone.d/mod_install_example_*.sh.installer ; do # Rule 4)
if [ "${subscript%_*}" == "mod_install_example" ] ; then # Rule 7)
. ${subscript}
fi
done
while [ $run -eq 1 ] ; do
eval ${example_menu} "'Exit menu and output variable.' 'run=0'"
done
echo $test
mod_install_example_subexample.sh.installer
#!/bin/bash
# [COPY] This script is in the Public Domain
example_subexample_submenu(){
gui_menu example_subexample 'SubExample Menu' 'Set variable to 123' 'test="123"'
}
example_menu="${example_menu} 'Sett variable to baz' 'test=\"baz\"'"
example_menu="${example_menu} 'Sub Menu' 'example_subexample_submenu'"
for subscript in /etc/stone.d/mod_install_example_subexample_*.sh.installer ; do # Rule 4)
if [ "${subscript%_*}" == "mod_install_example_subexample" ] ; then # Rule 7)
. ${subscript}
fi
done
