OpenCSW Bug Tracker


Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003635 [cswclassutils] regular use feature always 2009-04-13 19:59 2009-06-04 18:51
Reporter yann View Status public  
Assigned To bonivart
Priority normal Resolution fixed  
Status closed  
Summary 0003635: Support service that can't be autoenabled at first install
Description Some daemons can't be launched at all at first install without a bit of manual configuration, that the case of imapproxy which require an imap server to be given in imapproxy configuration file.

Currently, cswclassutils cswinitsmf will always tries to start the daemon if autoenable_daemons=yes, for cswimapproxy this would result in a service in maintenance state that would need to be cleared.

It would be nice to have support for this case, the service can't be launched at first install, but once it is configured and enabled by the administrator, it has to be re-launched at each upgrade.
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0005991)
bonivart (developer)
2009-04-21 17:17

Isn't this normally handled by the start script? Something like:

[ -f someconffile ] && startservice
(0005997)
yann (developer)
2009-04-21 21:12

The script already has this check, but as your script will always try to enable the service (if autoenable_daemons != no), the init script will exit and the imapproxy service will go in maintenance mode from SMF point of view.

It would be cleaner to have it not started at all at the first install.
(0006125)
yann (developer)
2009-05-17 16:57

Hi Peter,

Any news of this feature request ?
(0006211)
bonivart (developer)
2009-05-28 10:24

I think I will enable this via another tweak in the init script. OK?
(0006214)
bonivart (developer)
2009-05-28 14:44

I have put in an AUTOENABLE tweak to the init script, if it's no or false the service will not be enabled.

http://mirror.opencsw.org/testing/cswclassutils-1.12,REV=2009.05.28-SunOS5.8-all-CSW.pkg.gz [^]
(0006240)
skayser (administrator)
2009-06-01 17:37

Thanks for adding this feature, just tested it and ran into a small hitch. The tr used to translate from upper to lower, doesn't work with multibyte locales and thus the script fails when running in for example en_US.UTF-8. Also there is a space missing in one of the test clauses.

# pkgparam CSWcswclassutils VERSION
1.14,REV=2009.05.29

# locale
LANG=
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

# pkgutil -t http://mirror.opencsw.org/opencsw/testing [^] -u stunnel
...
Creating service script in /var/opt/csw/svc/method/svc-cswstunnel ...
Creating manifest ...
Configuring service in SMF ...
CSWstunnel is using Service Management Facility. The FMRI is svc:/network/cswstunnel:default
Bad string
/usr/sadm/install/scripts/i.cswinitsmf: test: ] missing

Transcript of the last part with set -x enabled:

AUTOENABLE=yes
+ grep ^#AUTOENABLE /etc/opt/csw/init.d/cswstunnel
+ [ #AUTOENABLE no ]
+ grep ^#AUTOENABLE /etc/opt/csw/init.d/cswstunnel
+ awk {print $2}
+ tr -s [:upper:] [:lower:]
Bad string
AUTOENABLE=
+ [ yes = yes -a != no -a != false]
/usr/sadm/install/scripts/i.cswinitsmf: test: ] missing

Note the "Bad string" warning and the empty AUTOENABLE afterwards. test complains because there is a space missing before the closing bracket.

When using /usr/xpg4/bin/tr in i.cswinitsmf instead of /bin/tr, installation works fine. See also tr(1).

Note: /usr/bin/tr supports character class
expressions only in singlebyte locales. Use
/usr/xpg4/bin/tr to support these expressions
in any locale.
(0006246)
bonivart (developer)
2009-06-02 19:17

Oops, sorry about that. Fixed the space and switched to xpg4/tr. Try:

http://mirror.opencsw.org/testing/cswclassutils-1.15,REV=2009.06.02-SunOS5.8-all-CSW.pkg.gz [^]
(0006252)
skayser (administrator)
2009-06-03 01:10

Works, thanks. What do you think about somehow evaluating the AUTOENABLE for classic init scripts also? From looking at the script, for $smf = no it will say "Starting $service" and try to run /etc/init.d/$service.

Taken stunnel, it doesn't make sense to run it without a proper configuration, that's why i use AUTOENABLE. Currently I have added a test -f conffile || exit 0 to its init script, but i was thinking about extending it with an error message like "stunnel configuration missing. Exiting.". Only with i.cswinitsmf this won't be seen by the user.

# grep -n "/etc/init.d/\$service start" /usr/sadm/install/scripts/i.cswinitsmf
298: /etc/init.d/$service start > /dev/null 2>&1

So if you could skip the /etc/init.d/$service start if AUTOENABLE says so, we would just have to make sure that our init scripts let users know why they bail out (like with the missing configuration). This way, upon reboot they would know why a service could not be started, but they wouldn't get a "Starting $service" with no immediate effect upon installation (like it is now).
(0006257)
bonivart (developer)
2009-06-03 10:47

I thought about it but I would have to choose between just skipping the start at end of install or not creating the rc-links and skipping start. The first would seem clean at install but after a reboot it would try to start it again, is that ok? The second would perhaps be ok at first but after the user has fixed the config they would have to create the rc-links themselves which is not very nice.

It's hard to implement it perfectly without the knowledge of state that SMF brings to the table.

What do you think?
(0006258)
skayser (administrator)
2009-06-03 12:03

"The first would seem clean at install but after a reboot it would try to start it again, is that ok?"

IMHO yes and you are right, definitely better than not creating the rc links.

Maintainers just need to make sure that their init scripts throw a meaningful warning when the service can't be started (config missing or similar), should be documented in the cswclassutils wiki, then the start attempt after reboot doesn't harm at all.
(0006259)
bonivart (developer)
2009-06-03 13:53

Ok, option 1 is now implemented, rc-links will be created but service will not be started if AUTOENABLE=no|false.

http://mirror.opencsw.org/testing/cswclassutils-1.16,REV=2009.06.03-SunOS5.8-all-CSW.pkg.gz [^]

I will try to add some text to the wiki about it.
(0006264)
bonivart (developer)
2009-06-04 10:55

I have tested it with smf_test 2.8 and it works.
(0006268)
bonivart (developer)
2009-06-04 18:51

Fix in 1.16 released today.


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker