do not create menuconfig during install, some style cleanups - Han

This commit is contained in:
fluxgen 2003-04-14 09:23:40 +00:00
parent 2623f307c0
commit b234bdae64

View file

@ -22,7 +22,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# $Id: fluxbox-generate_menu,v 1.28 2003/04/09 08:59:03 fluxgen Exp $
# $Id: fluxbox-generate_menu,v 1.29 2003/04/14 09:23:40 fluxgen Exp $
#
# Portability notes:
@ -91,9 +91,9 @@ fluxbox-generate_menu was brought to you by:
Henrik Kinnunen: Project leader.
Han Boetes: Packaging, debugging and scripts.
Simon Bowden: Cleanups and compatibility for sun.
Jeramy B. Smith: Packaging assistance, gnome and kde menu system.
Filippo Pappalardo: Italian locales and -t option.
Simon Bowden: Cleanups and compatibility for sun.
$WHOAMI: Innocent bystander.
EOF
@ -480,17 +480,20 @@ case ${LC_ALL} in
esac
# Set Defaults
FILENAME="${HOME}/.fluxbox/menu"
MENUTITLE="Fluxbox"
HOMEPAGE="fluxbox.org"
USERMENU="${HOME}/.fluxbox/usermenu"
FILENAME="${FILENAME:=${HOME}/.fluxbox/menu}"
MENUTITLE="${MENUTITLE:=Fluxbox}"
HOMEPAGE="${HOMEPAGE:=fluxbox.org}"
USERMENU="${USERMENU:=${HOME}/.fluxbox/usermenu}"
# Read the menuconfig file if it exists or else create it.
if [ -r ${HOME}/.fluxbox/menuconfig ];then
. ${HOME}/.fluxbox/menuconfig
else
if [ ! "$WHOAMI" = root ];then # this is only for users.
cat<<EOF> ${HOME}/.fluxbox/menuconfig
# But not during install time, use envvar for sun
if [ ! ${INSTALL}="Yes" ];then
if [ -r ${HOME}/.fluxbox/menuconfig ]; then
. ${HOME}/.fluxbox/menuconfig
else
if [ ! "$WHOAMI" = root ]; then # this is only for users.
if touch ${HOME}/.fluxbox/menuconfig; then
cat<<EOF> ${HOME}/.fluxbox/menuconfig
# This file is read by fluxbox-generate_menu. If you don't like a
# default you can change it here. Don't forget to remove the # in front
# of the line.
@ -539,9 +542,12 @@ else
# REMOVE=no
EOF
else
echo "Warning: I could't create ${HOME}/.fluxbox/menuconfig" >&2
fi
fi
fi
fi
# Get options.
while getopts ":Bkhragb:t:p:w:u:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do
case "${COMMAND_LINE_ARGUMENT}" in
@ -567,14 +573,14 @@ done
# Can we actually create ${FILENAME}
touch ${FILENAME} 2> /dev/null
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ]; then
echo "Fatal error: can't create $FILENAME" >&2
exit 1
fi
# backup menu
if [ -w "${FILENAME}" ]; then
if [ -f ${FILENAME}.firstbak ];then
if [ -f ${FILENAME}.firstbak ]; then
cp ${FILENAME} ${FILENAME}.firstbak
fi
mv ${FILENAME} ${FILENAME}.bak
@ -582,7 +588,7 @@ fi
# packagedatadir
if [ ! -d "${PKGDATADIR}" -o -z "${PKGDATADIR}" ]; then
if [ "`uname`" = "Linux" ];then
if [ "`uname`" = "Linux" ]; then
PKGDATADIR=/usr/share
else
PKGDATADIR=/usr/local/share
@ -602,7 +608,7 @@ fi
# find the default terminal
find_it $MY_TERM
if [ $? -ne 0 ];then
if [ $? -ne 0 ]; then
[ -n "$MY_TERM" ] && echo "Warning: you chose an invalid term." >&2
#The precise order is up for debate.
for term in Eterm aterm rxvt wterm xterm konsole gnome-terminal; do
@ -618,7 +624,7 @@ fi
# find the default browser
find_it $MY_BROWSER
if [ $? -ne 0 ];then
if [ $? -ne 0 ]; then
[ -n "$MY_BROWSER" ] && echo "Warning: you chose an invalid browser." >&2
#The precise order is up for debate.
for browser in opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do
@ -633,7 +639,7 @@ fi
# a unix system without any terms. that's odd
if [ -z "$DEFAULT_TERM" ];then
if [ -z "$DEFAULT_TERM" ]; then
cat <<EOF>&2
Warning: I can't find any terminal-emulators in your PATH.
Please fix your PATH or specify your favourite terminal with the -t option
@ -643,10 +649,10 @@ fi
# Start of menu
cat << EOF > ${FILENAME}
# Generated by fluxbox-genereate_menu
# Generated by fluxbox-generate_menu
#
# If you read this it means you want to edit this file manualy, so here
# are some usefull tips:
# If you read this it means you want to edit this file manually, so here
# are some useful tips:
#
# - You can add your own menu-entries to ~/.fluxbox/usermenu
#
@ -778,7 +784,7 @@ append_menu_end
if [ -d ${GPKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then
append_submenu "${GNOMEMENUTEXT}"
for a in `ls ${GPKGDATADIR}/gnome/apps/` ; do
if [ -d ${GPKGDATADIR}/gnome/apps/"${a}" ] ; then
if [ -d ${GPKGDATADIR}/gnome/apps/"${a}" ]; then
append_submenu "${a}"
menu_entry_dir "${GPKGDATADIR}/gnome/apps/${a}"
menu_entry_dircheck "/etc/X11/applnk/${a}"
@ -810,7 +816,7 @@ if [ -d ${KPKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then
fi
#User menu
if [ -r "${USERMENU}" ];then
if [ -r "${USERMENU}" ]; then
cat ${USERMENU} >> ${FILENAME}
fi
@ -826,14 +832,14 @@ append_submenu "${FBSETTINGSMENU}"
append_menu_end
# Backgroundmenu
if [ "$BACKGROUNDMENUITEM" = "yes" ];then
if [ "$BACKGROUNDMENUITEM" = "yes" ]; then
append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}"
if [ `ls -1 ${HOME}/.fluxbox/backgrounds 2>/dev/null |wc -l` -gt 30 ]; then
menucounter=1 ; counter=1
append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}"
for i in ${HOME}/.fluxbox/backgrounds/* ${PKGDATADIR}/fluxbox/backgrounds/* ; do
counter=`expr $counter + 1`
if [ $counter -eq 30 ];then
if [ $counter -eq 30 ]; then
counter=1
menucounter=`expr $menucounter + 1`
append_menu_end
@ -876,7 +882,7 @@ append_menu_end
# this function removes empty menu items. It can not yet remove nested
# empty submenus :\
if [ ! "${REMOVE}" ];then
if [ ! "${REMOVE}" ]; then
clean_up
fi