Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Apr 23, 2011, at 4:42 AM, Thomas Dickey wrote: On Sat, Apr 23, 2011 at 08:54:51AM +0100, Bruce Cran wrote: On Fri, 22 Apr 2011 09:52:44 -0700 Devin Teske dte...@vicor.com wrote: Looks like `--hline' is not supported anymore. Thinking this should either be patched or documented in ERRATA/UPGRADING. I think you mean UPDATING :) perhaps. But reporting bugs is nicer than long discussion threads. I've released a new version of my host-setup utility. Available here: http://druidbsd.sourceforge.net/download/host-setup.txt or here: http://druidbsd.sourceforge.net/ Now at version 3.2, here's the delta: - Added support for FreeBSD-9.x's new dialog(1) (which lacks `--hline' support). - Added support for /usr/ports/x11/Xdialog You can now execute this on the console or in X windows. Default is console, to execute in X windows, execute: host-setup -X -- Cheers, Devin Teske - LEGAL DISCLAIMER - This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed. Any use, distribution, copying or disclosure by any other person is strictly prohibited. If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy. - FUN STUFF - -BEGIN GEEK CODE BLOCK- Version 3.12 GAT/CS/B/CC/E/IT/MC/M/MU/P/S/TW d+(++) s: a- C+++@$ UB$ P@$ L$ E- W+++ N? o? K? w@ O M++$ V- PS+++ PE@ Y+ PGP- t(+) 5? X(+) R(-) tv+ b+++ DI+ D+(++) G++ e h r+++ z+++ --END GEEK CODE BLOCK-- http://www.geekcode.com/ - END TRANSMISSION - _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Bruce Cran [mailto:br...@cran.org.uk] Sent: Friday, April 22, 2011 9:35 AM To: Alexander Best Cc: Devin Teske; freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri, 22 Apr 2011 15:41:46 + Alexander Best arun...@freebsd.org wrote: FreeBSD 9.0-CURRENT amd64 A new version of dialog was imported a few days ago - maybe something broke? Looks like `--hline' is not supported anymore. Thinking this should either be patched or documented in ERRATA/UPGRADING. what would be the equivalent to --hline in the new dialog(1) package? -- Bruce Cran _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ -- a13x ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
RE: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
-Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Thursday, April 28, 2011 12:27 AM To: Devin Teske Cc: 'Bruce Cran'; freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Bruce Cran [mailto:br...@cran.org.uk] Sent: Friday, April 22, 2011 9:35 AM To: Alexander Best Cc: Devin Teske; freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri, 22 Apr 2011 15:41:46 + Alexander Best arun...@freebsd.org wrote: FreeBSD 9.0-CURRENT amd64 A new version of dialog was imported a few days ago - maybe something broke? Looks like `--hline' is not supported anymore. Thinking this should either be patched or documented in ERRATA/UPGRADING. what would be the equivalent to --hline in the new dialog(1) package? There are no equivalents to either the `--hline' or `--hfile' options. Compare the 8.2-RELEASE manual to the 9-CURRENT manual: 8.2-RELEASE: http://www.freebsd.org/cgi/man.cgi?query=dialogapropos=0sektion=0manpath=Free BSD+8.2-RELEASEformat=html 9-CURRENT: http://www.freebsd.org/cgi/man.cgi?query=dialogapropos=0sektion=0manpath=Free BSD+9-currentformat=html When comparing the above man-pages, issues include: OLD SYNTAX: --hline line NEW SYNTAX: Not available anymore?! ISSUE: No longer capable of setting string to be displayed at bottom of dialog box (exact opposite of --title). OLD SYNTAX: --hfile file NEW SYNTAX: Not available anymore?! ISSUE: No longer capable of setting a file to be displayed by pressing either ? or F1. OLD SYNTAX: --yesno text height width [yes|no] NEW SYNTAX: --yesno text height width ISSUE: Optional fourth argument to change default selection no longer accepted?! DISCUSS: Without fourth argument to change default selection, is the programmer expected to finagle this by using common-options `--no-label YES' and `--yes-label NO' and change logic to treat NO as YES and vice-versa? OLD SYNTAX: --prgbox command height width NEW SYNTAX: Not available anymore?! ISSUE: No longer capable of displaying output of command in dialog box? DISCUSS: As an alternative, I guess we could output the text to a temporary file and then use --textbox OLD SYNTAX: --ftree file FS text height width menu-height NEW SYNTAX: Not available anymore?! ISSUE: No longer capable of displaying a tree described by the data from `file' (which should contain find(1) output). DISCUSS: There appears to be no analog (this is an informational dialog that takes no user input opposed to --dselect and --fselect which are for taking user input in the new dialog; guess we're just out of luck on these ones). OLD SYNTAX: --tree FS text height width menu-height [ item ] ... NEW SYNTAX: Not available anymore?! ISSUE: No longer capable of displaying a tree described by a series of arguments? DISCUSS: Like --ftree, there appears to be no analog. Don't get me wrong... the new dialog *adds* more options than it takes away (or breaks). However, it's frustrating that backward compatibility is not being retained. On a side-note, I notice that my CentOS 4.7 system is running a dialog that matches syntax exactly with what was imported into RELENG_9 (this is a great thing -- meaning I can write dialog(1) based scripts that are compatible with both Linux and FreeBSD with very little effort). Though I'd still like to see the gaps filled so that we could also run legacy dialog(1) based scripts designed for the [8.x and] older dialog(1). -- Devin -- Bruce Cran _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ -- a13x _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Fri, 22 Apr 2011 09:52:44 -0700 Devin Teske dte...@vicor.com wrote: Looks like `--hline' is not supported anymore. Thinking this should either be patched or documented in ERRATA/UPGRADING. I think you mean UPDATING :) -- Bruce Cran ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Sat, Apr 23, 2011 at 08:54:51AM +0100, Bruce Cran wrote: On Fri, 22 Apr 2011 09:52:44 -0700 Devin Teske dte...@vicor.com wrote: Looks like `--hline' is not supported anymore. Thinking this should either be patched or documented in ERRATA/UPGRADING. I think you mean UPDATING :) perhaps. But reporting bugs is nicer than long discussion threads. -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net pgp9H9Hlo9DqO.pgp Description: PGP signature
Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Thu Apr 21 11, Devin Teske wrote: Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt otaku% sudo ./host-setup.txt User cancelled. otaku% echo $? 1 otaku% or http://druidbsd.sourceforge.net/download/host-setup.gz or http://druidbsd.sourceforge.net/ For those not familiar with my host-setup(1) utility, it is a 2,500+ line shell script that utilizes the dialog(1) utility to walk the system administrator through setting up their TimeZone, Hostname, Network Interfaces, Default Gateway, and DNS. Our custom FreeBSD installer sets this script as the root login shell, making it very easy for field engineers to quickly get a system on the network without having to use the command-line (and without having to reboot either). Underneath the hood - behind the system of prompts and dialogs - this script manages both the contents of /etc/rc.conf, /etc/resolv.conf, and others as well as utilizing ifconfig(8), route(8), and many other tools to avoid requiring a reboot, prompting you if you would like to make the new changes effective when values are changed from their active settings. Here's the patch to show the details: --- host-setup.3_0 2011-02-10 19:14:30.0 -0800 +++ host-setup 2011-04-21 13:38:58.0 -0700 @@ -2,12 +2,12 @@ # -*- tab-width: 4 -*- ;; Emacs # vi: set tabstop=4 :: Vi/ViM # -# Revision: 3.0 +# Revision: 3.1 # Created: September 21st, 2010 -# Last Modified: December 6th, 2010 +# Last Modified: April 21st, 2011 COPYRIGHT # -# Devin Teske (c)2006-2010. All Rights Reserved. +# Devin Teske (c)2006-2011. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -1353,8 +1353,10 @@ dialog_input_hostname() # permissions and ownership to match resolv.conf(5) before # we write it out and mv(1) it into place). # - quietly chmod $( stat -f '%#Lp' $RESOLV_CONF ) $tmpfile - quietly chown $( stat -f '%u:%g' $RESOLV_CONF ) $tmpfile + local mode=$( stat -f '%#Lp' $RESOLV_CONF 2 /dev/null ) + local owner=$( stat -f '%u:%g' $RESOLV_CONF 2 /dev/null ) + quietly chmod ${mode:-0644} $tmpfile + quietly chown ${owner:-root:wheel} $tmpfile # # Operate on resolv.conf(5), replacing only the last @@ -1646,7 +1648,7 @@ dialog_input_netmask() # while :; do - dialog --title $brand${band:+}${progname:-$0} \ + dialog --title $brand${brand:+ }${progname:-$0} \ --hline Use numbers, punctuation, TAB or ENTER \ --inputbox $msg 10 50 \ $_netmask \ @@ -1664,7 +1666,7 @@ dialog_input_netmask() [ $retval -eq $SUCCESS ] || return $retval # Return success if NULL value was entered - [ $_netmask ] || return $SUCCESS + [ $_input ] || return $SUCCESS # Take only the first word of the user's input _netmask=$_input @@ -1705,7 +1707,7 @@ dialog_input_options() msg=Please enter additional network media options to be msg=$msg passed to ifconfig(8) for the $interface interface: -dialog --title $brand${band:+}${progname:-$0} \ +dialog --title $brand${brand:+ }${progname:-$0} \ --hline Use numbers, punctuation, TAB or ENTER \ --inputbox $msg 9 70 \ $options \ @@ -2183,9 +2185,12 @@ dialog_menu_netdev_edit() local dr=$( sysrc_get defaultrouter ) err err=$( ifconfig $interface inet $ipaddr \ netmask $netmask $options 21 ) - if [ $? -eq $SUCCESS -a $dr ]; then -err=$( route add default $dr 21 ) -[ $? -eq $SUCCESS ] || dialog_msgbox $err + if [ $? -eq $SUCCESS ]; then +if [ $dr -a $dr != NO ]; then + err=$( route add default $dr 21 ) + [ $? -eq $SUCCESS ] || \
RE: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
-Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 7:55 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; Teske, Devin Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Thu Apr 21 11, Devin Teske wrote: Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt otaku% sudo ./host-setup.txt User cancelled. otaku% echo $? 1 otaku% Can you provide me with the output of uname -spr? It's working fine for me on FreeBSD 8.1-RELEASE i386. Where you're bombing out is line 2403: [ $retval -eq 0 ] || die User cancelled. Functionally, that is testing the return status of dialog(1) for the initial menu. See if you can execute this (a rough approximation of the initial menu): dialog --clear --title foo --hline bar --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo A menu should appear. Select an item and then execute for me: echo $? If the above doesn't work, then I suspect that your dialog(1) is not working properly. I'd then go and try this as a sanity check: cd /usr/share/examples/dialog sh menubox echo $? The result in both cases (as long as you actually select a menu item) should be 0. Also... (just as a sanity check for me) your /bin/sh is not a symlink to bash is it? -- Devin or http://druidbsd.sourceforge.net/download/host-setup.gz or http://druidbsd.sourceforge.net/ For those not familiar with my host-setup(1) utility, it is a 2,500+ line shell script that utilizes the dialog(1) utility to walk the system administrator through setting up their TimeZone, Hostname, Network Interfaces, Default Gateway, and DNS. Our custom FreeBSD installer sets this script as the root login shell, making it very easy for field engineers to quickly get a system on the network without having to use the command-line (and without having to reboot either). Underneath the hood - behind the system of prompts and dialogs - this script manages both the contents of /etc/rc.conf, /etc/resolv.conf, and others as well as utilizing ifconfig(8), route(8), and many other tools to avoid requiring a reboot, prompting you if you would like to make the new changes effective when values are changed from their active settings. Here's the patch to show the details: --- host-setup.3_0 2011-02-10 19:14:30.0 -0800 +++ host-setup 2011-04-21 13:38:58.0 -0700 @@ -2,12 +2,12 @@ # -*- tab-width: 4 -*- ;; Emacs # vi: set tabstop=4 :: Vi/ViM # -# Revision: 3.0 +# Revision: 3.1 # Created: September 21st, 2010 -# Last Modified: December 6th, 2010 +# Last Modified: April 21st, 2011 COPYRIGHT # -# Devin Teske (c)2006-2010. All Rights Reserved. +# Devin Teske (c)2006-2011. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -1353,8 +1353,10 @@ dialog_input_hostname() # permissions and ownership to match resolv.conf(5) before # we write it out and mv(1) it into place). # - quietly chmod $( stat -f '%#Lp' $RESOLV_CONF ) $tmpfile - quietly chown $( stat -f '%u:%g' $RESOLV_CONF ) $tmpfile + local mode=$( stat -f '%#Lp' $RESOLV_CONF 2 /dev/null ) + local owner=$( stat -f '%u:%g' $RESOLV_CONF 2 /dev/null ) + quietly chmod ${mode:-0644} $tmpfile + quietly chown ${owner:-root:wheel} $tmpfile # # Operate on resolv.conf(5), replacing only the last @@ -1646,7 +1648,7 @@ dialog_input_netmask() # while :; do - dialog --title $brand${band:+}${progname:-$0} \ + dialog --title $brand${brand:+ }${progname:-$0} \ --hline Use numbers, punctuation, TAB or ENTER \ --inputbox $msg 10 50 \ $_netmask \ @@ -1664,7 +1666,7 @@ dialog_input_netmask() [ $retval -eq $SUCCESS ] || return $retval # Return success if NULL value was entered - [ $_netmask ] || return $SUCCESS
Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 7:55 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; Teske, Devin Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Thu Apr 21 11, Devin Teske wrote: Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt otaku% sudo ./host-setup.txt User cancelled. otaku% echo $? 1 otaku% Can you provide me with the output of uname -spr? FreeBSD 9.0-CURRENT amd64 It's working fine for me on FreeBSD 8.1-RELEASE i386. Where you're bombing out is line 2403: [ $retval -eq 0 ] || die User cancelled. Functionally, that is testing the return status of dialog(1) for the initial menu. See if you can execute this (a rough approximation of the initial menu): dialog --clear --title foo --hline bar --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo doesn't work. :( otaku% echo $? 255 otaku% cat /tmp/dialog.menu.foo Error: Unknown option --hline. Use --help to list options. otaku% taku% whereis dialog dialog: /usr/bin/dialog /usr/share/man/en.ISO8859-15/man1/dialog.1.gz /usr/src/gnu/usr.bin/dialog otaku% /usr/bin/dialog cdialog (ComeOn Dialog!) version 1.1-20100428 Copyright 2000-2007,2008 Thomas E. Dickey This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [...] A menu should appear. Select an item and then execute for me: echo $? If the above doesn't work, then I suspect that your dialog(1) is not working properly. I'd then go and try this as a sanity check: cd /usr/share/examples/dialog otaku% cd /usr/share/examples/dialog cd: no such file or directory: /usr/share/examples/dialog sh menubox echo $? The result in both cases (as long as you actually select a menu item) should be 0. Also... (just as a sanity check for me) your /bin/sh is not a symlink to bash is it? otaku% file /bin/sh /bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900034), stripped -- Devin or http://druidbsd.sourceforge.net/download/host-setup.gz or http://druidbsd.sourceforge.net/ For those not familiar with my host-setup(1) utility, it is a 2,500+ line shell script that utilizes the dialog(1) utility to walk the system administrator through setting up their TimeZone, Hostname, Network Interfaces, Default Gateway, and DNS. Our custom FreeBSD installer sets this script as the root login shell, making it very easy for field engineers to quickly get a system on the network without having to use the command-line (and without having to reboot either). Underneath the hood - behind the system of prompts and dialogs - this script manages both the contents of /etc/rc.conf, /etc/resolv.conf, and others as well as utilizing ifconfig(8), route(8), and many other tools to avoid requiring a reboot, prompting you if you would like to make the new changes effective when values are changed from their active settings. Here's the patch to show the details: --- host-setup.3_0 2011-02-10 19:14:30.0 -0800 +++ host-setup 2011-04-21 13:38:58.0 -0700 @@ -2,12 +2,12 @@ # -*- tab-width: 4 -*- ;; Emacs # vi: set tabstop=4 :: Vi/ViM # -# Revision: 3.0 +# Revision: 3.1 # Created: September 21st, 2010 -# Last Modified: December 6th, 2010 +# Last Modified: April 21st, 2011 COPYRIGHT # -# Devin Teske (c)2006-2010. All Rights Reserved. +# Devin Teske (c)2006-2011. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -1353,8 +1353,10 @@ dialog_input_hostname() # permissions and ownership to match resolv.conf(5) before # we write it out and mv(1) it into place). # - quietly chmod $( stat -f '%#Lp' $RESOLV_CONF ) $tmpfile - quietly
Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
On Fri, 22 Apr 2011 15:41:46 + Alexander Best arun...@freebsd.org wrote: FreeBSD 9.0-CURRENT amd64 A new version of dialog was imported a few days ago - maybe something broke? -- Bruce Cran ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
dialog(1) changed in RELENG_9 (was RE: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD)
-Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 8:42 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 7:55 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; Teske, Devin Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Thu Apr 21 11, Devin Teske wrote: Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt otaku% sudo ./host-setup.txt User cancelled. otaku% echo $? 1 otaku% Can you provide me with the output of uname -spr? FreeBSD 9.0-CURRENT amd64 I haven't yet had a chance to pull that one down and install it yet. Hopefully you can help me out with this one here. It's working fine for me on FreeBSD 8.1-RELEASE i386. Where you're bombing out is line 2403: [ $retval -eq 0 ] || die User cancelled. Functionally, that is testing the return status of dialog(1) for the initial menu. See if you can execute this (a rough approximation of the initial menu): dialog --clear --title foo --hline bar --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo doesn't work. :( Bummer! We'll have to fix that. otaku% echo $? 255 otaku% cat /tmp/dialog.menu.foo Error: Unknown option --hline. Use --help to list options. Aha! I think I remember seeing in the list a thread related to swapping out dialog(1) for something new. This must be it. otaku% taku% whereis dialog dialog: /usr/bin/dialog /usr/share/man/en.ISO8859-15/man1/dialog.1.gz /usr/src/gnu/usr.bin/dialog otaku% /usr/bin/dialog cdialog (ComeOn Dialog!) version 1.1-20100428 Copyright 2000-2007,2008 Thomas E. Dickey This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I can't recall as I don't have the thread in front of me, but why was dialog(1) replaced with cdialog? licensing? performance? I guess I could code my script to support this new dialog(1), but... can you see if the below works (I removed the --hline option): dialog --clear --title foo --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo If that succeeds, then I can modify my script to not use `--hline' on RELENG_9 and higher (referencing `sysctl -n kern.osreldate` for example). [...] A menu should appear. Select an item and then execute for me: echo $? If the above doesn't work, then I suspect that your dialog(1) is not working properly. I'd then go and try this as a sanity check: cd /usr/share/examples/dialog otaku% cd /usr/share/examples/dialog cd: no such file or directory: /usr/share/examples/dialog Really? I would have thought that the examples in that directory (which are merely shell scripts) would have been recoded for cdialog rather than altogether removed. Maybe there was licensing issues there too. Was there? sh menubox echo $? The result in both cases (as long as you actually select a menu item) should be 0. Also... (just as a sanity check for me) your /bin/sh is not a symlink to bash is it? otaku% file /bin/sh /bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900034), stripped Cool. Though I'm still disappointed that my beloved dialog(1) has gone missing (rather, replaced with something doesn't accept the same arguments and/or options)(which is the problem that we're experiencing here). Is there anybody familiar with the changing-out dialog(1) that can bring me up to speed with reasoning and specifics for RELENG_9? Also, might it be prudent -- before cutting 9_0_RELEASE -- to add the fact that dialog(1) no longer accepts `--hline' to the UPGRADING and/or ERRATA documents? -- Devin -- Devin or http://druidbsd.sourceforge.net/download/host-setup.gz or http://druidbsd.sourceforge.net/ For those not familiar with my host-setup(1) utility, it is a 2,500+ line shell script that utilizes the dialog(1) utility
RE: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
-Original Message- From: Bruce Cran [mailto:br...@cran.org.uk] Sent: Friday, April 22, 2011 9:35 AM To: Alexander Best Cc: Devin Teske; freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri, 22 Apr 2011 15:41:46 + Alexander Best arun...@freebsd.org wrote: FreeBSD 9.0-CURRENT amd64 A new version of dialog was imported a few days ago - maybe something broke? Looks like `--hline' is not supported anymore. Thinking this should either be patched or documented in ERRATA/UPGRADING. -- Bruce Cran _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: dialog(1) changed in RELENG_9 (was RE: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD)
On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 8:42 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 7:55 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; Teske, Devin Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Thu Apr 21 11, Devin Teske wrote: Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt otaku% sudo ./host-setup.txt User cancelled. otaku% echo $? 1 otaku% Can you provide me with the output of uname -spr? FreeBSD 9.0-CURRENT amd64 I haven't yet had a chance to pull that one down and install it yet. Hopefully you can help me out with this one here. It's working fine for me on FreeBSD 8.1-RELEASE i386. Where you're bombing out is line 2403: [ $retval -eq 0 ] || die User cancelled. Functionally, that is testing the return status of dialog(1) for the initial menu. See if you can execute this (a rough approximation of the initial menu): dialog --clear --title foo --hline bar --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo doesn't work. :( Bummer! We'll have to fix that. otaku% echo $? 255 otaku% cat /tmp/dialog.menu.foo Error: Unknown option --hline. Use --help to list options. Aha! I think I remember seeing in the list a thread related to swapping out dialog(1) for something new. This must be it. otaku% taku% whereis dialog dialog: /usr/bin/dialog /usr/share/man/en.ISO8859-15/man1/dialog.1.gz /usr/src/gnu/usr.bin/dialog otaku% /usr/bin/dialog cdialog (ComeOn Dialog!) version 1.1-20100428 Copyright 2000-2007,2008 Thomas E. Dickey This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I can't recall as I don't have the thread in front of me, but why was dialog(1) replaced with cdialog? licensing? performance? I guess I could code my script to support this new dialog(1), but... can you see if the below works (I removed the --hline option): dialog --clear --title foo --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo If that succeeds, then I can modify my script to not use `--hline' on RELENG_9 and higher (referencing `sysctl -n kern.osreldate` for example). that works with $? == 0 [...] A menu should appear. Select an item and then execute for me: echo $? If the above doesn't work, then I suspect that your dialog(1) is not working properly. I'd then go and try this as a sanity check: cd /usr/share/examples/dialog otaku% cd /usr/share/examples/dialog cd: no such file or directory: /usr/share/examples/dialog Really? I would have thought that the examples in that directory (which are merely shell scripts) would have been recoded for cdialog rather than altogether removed. Maybe there was licensing issues there too. Was there? sh menubox echo $? The result in both cases (as long as you actually select a menu item) should be 0. Also... (just as a sanity check for me) your /bin/sh is not a symlink to bash is it? otaku% file /bin/sh /bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900034), stripped Cool. Though I'm still disappointed that my beloved dialog(1) has gone missing (rather, replaced with something doesn't accept the same arguments and/or options)(which is the problem that we're experiencing here). Is there anybody familiar with the changing-out dialog(1) that can bring me up to speed with reasoning and specifics for RELENG_9? Also, might it be prudent -- before cutting 9_0_RELEASE -- to add the fact that dialog(1) no longer accepts `--hline' to the UPGRADING and/or ERRATA documents? -- Devin -- Devin
Re: dialog(1) changed in RELENG_9 (was RE: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD)
On 04/22/11 11:50, Devin Teske wrote: -Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 8:42 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; 'Teske, Devin' Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Fri Apr 22 11, Devin Teske wrote: -Original Message- From: Alexander Best [mailto:arun...@freebsd.org] Sent: Friday, April 22, 2011 7:55 AM To: Devin Teske Cc: freebsd-hackers@freebsd.org; freebsd-questi...@freebsd.org; Teske, Devin Subject: Re: [UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD On Thu Apr 21 11, Devin Teske wrote: Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt otaku% sudo ./host-setup.txt User cancelled. otaku% echo $? 1 otaku% Can you provide me with the output of uname -spr? FreeBSD 9.0-CURRENT amd64 I haven't yet had a chance to pull that one down and install it yet. Hopefully you can help me out with this one here. It's working fine for me on FreeBSD 8.1-RELEASE i386. Where you're bombing out is line 2403: [ $retval -eq 0 ] || die User cancelled. Functionally, that is testing the return status of dialog(1) for the initial menu. See if you can execute this (a rough approximation of the initial menu): dialog --clear --title foo --hline bar --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo doesn't work. :( Bummer! We'll have to fix that. otaku% echo $? 255 otaku% cat /tmp/dialog.menu.foo Error: Unknown option --hline. Use --help to list options. Aha! I think I remember seeing in the list a thread related to swapping out dialog(1) for something new. This must be it. otaku% taku% whereis dialog dialog: /usr/bin/dialog /usr/share/man/en.ISO8859-15/man1/dialog.1.gz /usr/src/gnu/usr.bin/dialog otaku% /usr/bin/dialog cdialog (ComeOn Dialog!) version 1.1-20100428 Copyright 2000-2007,2008 Thomas E. Dickey This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I can't recall as I don't have the thread in front of me, but why was dialog(1) replaced with cdialog? licensing? performance? I guess I could code my script to support this new dialog(1), but... can you see if the below works (I removed the --hline option): dialog --clear --title foo --menu abc 17 55 9 1 a 2 b 3 c 4 d 5 e X x 2 /tmp/dialog.menu.foo If that succeeds, then I can modify my script to not use `--hline' on RELENG_9 and higher (referencing `sysctl -n kern.osreldate` for example). [...] A menu should appear. Select an item and then execute for me: echo $? If the above doesn't work, then I suspect that your dialog(1) is not working properly. I'd then go and try this as a sanity check: cd /usr/share/examples/dialog otaku% cd /usr/share/examples/dialog cd: no such file or directory: /usr/share/examples/dialog Really? I would have thought that the examples in that directory (which are merely shell scripts) would have been recoded for cdialog rather than altogether removed. Maybe there was licensing issues there too. Was there? sh menubox echo $? The result in both cases (as long as you actually select a menu item) should be 0. Also... (just as a sanity check for me) your /bin/sh is not a symlink to bash is it? otaku% file /bin/sh /bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900034), stripped Cool. Though I'm still disappointed that my beloved dialog(1) has gone missing (rather, replaced with something doesn't accept the same arguments and/or options)(which is the problem that we're experiencing here). Is there anybody familiar with the changing-out dialog(1) that can bring me up to speed with reasoning and specifics for RELENG_9? Also, might it be prudent -- before cutting 9_0_RELEASE -- to add the fact that dialog(1) no longer accepts `--hline' to the UPGRADING and/or ERRATA documents? It's almost entirely compatible, but I apologize for the breakage you experienced. The reasons it was replaced it were that it (a) has a better libdialog API, (b) has a better license (LGPL instead of GPL), (c) is maintained, and (d) supports 8-bit character sets. If there is some specific feature you are interested in (--hline for instance), I'd suggest writing to Thomas Dickey, the maintainer. -Nathan
[UPDATE] host-setup(1): a dialog(1)-based utility for configuring FreeBSD
Hi List Members! I'm proud to announce the first update to my host-setup utility (a dialog(1)-based host configurator for FreeBSD). The following changes have been made: - fixed bug where /etc/resolv.conf would be created with 0600 permissions - fixed bug when switching from one default gateway to NO default gateway - fixed typo in the title of netmask prompt and ifconfig options dialog - fixed bug that prevented entry of netmask if no netmask is configured You can get the updated version here: http://druidbsd.sourceforge.net/download/host-setup.txt or http://druidbsd.sourceforge.net/download/host-setup.gz or http://druidbsd.sourceforge.net/ For those not familiar with my host-setup(1) utility, it is a 2,500+ line shell script that utilizes the dialog(1) utility to walk the system administrator through setting up their TimeZone, Hostname, Network Interfaces, Default Gateway, and DNS. Our custom FreeBSD installer sets this script as the root login shell, making it very easy for field engineers to quickly get a system on the network without having to use the command-line (and without having to reboot either). Underneath the hood - behind the system of prompts and dialogs - this script manages both the contents of /etc/rc.conf, /etc/resolv.conf, and others as well as utilizing ifconfig(8), route(8), and many other tools to avoid requiring a reboot, prompting you if you would like to make the new changes effective when values are changed from their active settings. Here's the patch to show the details: --- host-setup.3_0 2011-02-10 19:14:30.0 -0800 +++ host-setup 2011-04-21 13:38:58.0 -0700 @@ -2,12 +2,12 @@ # -*- tab-width: 4 -*- ;; Emacs # vi: set tabstop=4 :: Vi/ViM # -# Revision: 3.0 +# Revision: 3.1 # Created: September 21st, 2010 -# Last Modified: December 6th, 2010 +# Last Modified: April 21st, 2011 COPYRIGHT # -# Devin Teske (c)2006-2010. All Rights Reserved. +# Devin Teske (c)2006-2011. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -1353,8 +1353,10 @@ dialog_input_hostname() # permissions and ownership to match resolv.conf(5) before # we write it out and mv(1) it into place). # - quietly chmod $( stat -f '%#Lp' $RESOLV_CONF ) $tmpfile - quietly chown $( stat -f '%u:%g' $RESOLV_CONF ) $tmpfile + local mode=$( stat -f '%#Lp' $RESOLV_CONF 2 /dev/null ) + local owner=$( stat -f '%u:%g' $RESOLV_CONF 2 /dev/null ) + quietly chmod ${mode:-0644} $tmpfile + quietly chown ${owner:-root:wheel} $tmpfile # # Operate on resolv.conf(5), replacing only the last @@ -1646,7 +1648,7 @@ dialog_input_netmask() # while :; do - dialog --title $brand${band:+}${progname:-$0} \ + dialog --title $brand${brand:+ }${progname:-$0} \ --hline Use numbers, punctuation, TAB or ENTER \ --inputbox $msg 10 50 \ $_netmask \ @@ -1664,7 +1666,7 @@ dialog_input_netmask() [ $retval -eq $SUCCESS ] || return $retval # Return success if NULL value was entered - [ $_netmask ] || return $SUCCESS + [ $_input ] || return $SUCCESS # Take only the first word of the user's input _netmask=$_input @@ -1705,7 +1707,7 @@ dialog_input_options() msg=Please enter additional network media options to be msg=$msg passed to ifconfig(8) for the $interface interface: -dialog --title $brand${band:+}${progname:-$0} \ +dialog --title $brand${brand:+ }${progname:-$0} \ --hline Use numbers, punctuation, TAB or ENTER \ --inputbox $msg 9 70 \ $options \ @@ -2183,9 +2185,12 @@ dialog_menu_netdev_edit() local dr=$( sysrc_get defaultrouter ) err err=$( ifconfig $interface inet $ipaddr \ netmask $netmask $options 21 ) - if [ $? -eq $SUCCESS -a $dr ]; then -err=$( route add default $dr 21 ) -[ $? -eq $SUCCESS ] || dialog_msgbox $err + if [ $? -eq $SUCCESS ]; then +if [ $dr -a $dr != NO ]; then + err=$( route add default $dr 21 ) + [ $? -eq $SUCCESS ] || \ + dialog_msgbox $err +fi else dialog_msgbox $err fi @@ -2524,7 +2529,7 @@ exit $SUCCESS # # $Header$ # -# $Copyright: 2006-2010. Devin Teske. All Rights Reserved. $ +# $Copyright: