[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: help with packaging (preinst scripts)



Thanks a lot for your answers.

I know this looks ugly, but don't worry it's not really meant for Debian,
I'm working on our of our company's packages ;)

that doesn't
sound like a great idea. What are you doing?

well actually the package will install some software that has to be run by
a specific user, and this user has to have a password so that some
admins can log into the account for specific tasks, but not every user
of the system.

See http://anonscm.debian.org/viewvc/pkg-exim4/exim/trunk/debian/exim4-config.postinst?view=markup around line 193

193	if [ "$1" = "configure" ]&&\
194	        ! getent passwd Debian-exim>  /dev/null ; then
195	        echo 'Adding system-user for exim (v4)' 1>&2
196	        adduser --system --group --quiet --home /var/spool/exim4 \
197	                --no-create-home --disabled-login --force-badname Debian-exim
198	fi
Note that this is the postinst rather than preinst.


thanks, but the account creation was already OK, it's just the password bit that's
bothering me.

2. ssh-keygen with no user input ("Enter passphrase")
Run ssh-keygen with no stdin (</dev/null or similar, I think works)

will try that, thanks.

3. add/edit some MySQL tables without knowing the MySQL root password
Urgh. This sounds uglier and uglier :)  Provide some SQL  to achieve what you
want in a file in the package, as a very first step. Make sure you've depended
on MySQL.  Will you know what the correct Database name will be? Can you guarantee
it will exist?

here's the thing : I'm setting up software that will require a certain database with certain tables to be present (specific to this app, so yes I know which ones). If MySQL is not installed, it will be installed as a dependency. If the database & tables are not present (first install), I create them (using a SQL file, like you said), but if
MySQL is already running I don't want to have to stop it, do my changes and
restart it, I'd like to connect to the MySQL server as root and do the changes live,
even if the root MySQL server has a password set.

I've fooled around with Expect for 1. and 2., and tried
mysqld_safe --skip-grant-tables for 3., but I feel
lame (and I have to have my preinst script stop/start the
MySQL server during install) ..

If I'm not asking the correct list, I'm sorry, but could you please
direct me to the documentation I should read or other mailing list
I should contact ?
debian-mentors for beginner packaging questions.


OK, but I guess they only deal with packages within the Debian distribution
itself, not "private" packages ?

Thanks,
David.


Reply to: