tech-pkg archive

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

Re: Random string generation during *-install



Le 24/05/2015 20:47, Kamil Rytarowski a écrit :
Jean-Yves Migeon
What is the correct way of generating a fixed random string on
pre-install or do-install stage?

I Was thinking along the line "openssl rand -hex <size>" , however I
can't seem to find any example in current pkgsrc nor any other
equivalent command. Is it safe to assume that openssl is available at
this stage even on !NetBSD platforms?

Once I had to do something similar in a shell script and replace bash(1)
$RANDOM with a portable alternative.

I went for awk(1), initial ideas are at http://awk.info/?tip/random

Thanks. I ended up using urandom and tr(1) and delete any non printable char, not quite perfect but does an ok job.

BTW is there a way to add arbitrary commands to a pkginstall's INSTALL script? Just wondering whether binary packages would add even more restrictions to the environment (not needed in my present scenario, but alas, sooner or later...)

--
Jean-Yves Migeon


Home | Main Index | Thread Index | Old Index