Skip to contentSkip to conversation

do pkg_postinst() scripts need to start with "#!/bin/sh -e"?

DISCUSSION Robert P. J. Day 2 participants 4 messages Jan 9, 2015 – Jan 10, 2015

lore
Share & tools
lore
#0 lore raw

more manual pedantry -- dev manual, section 5.3.16, suggests:

A post-installation function has the following structure:

     pkg_postinst_PACKAGENAME() {
     #!/bin/sh -e
     # Commands to carry out
     }

except that every example of a pkg_postinst() script i've ever seen does not contain that initial hash-bang line, so the manual should at least be reworded to be consistent with the code base.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 5 lines · Robert P. J. Day

more manual pedantry -- dev manual, section 5.3.16, suggests:

A post-installation function has the following structure:

Quoted 8 lines
     pkg_postinst_PACKAGENAME() {
     #!/bin/sh -e
     # Commands to carry out
     }

except that every example of a pkg_postinst() script i've ever seen does not contain that initial hash-bang line, so the manual should at least be reworded to be consistent with the code base.

i take it back, i just ran across this example in base-passwd.bb:

pkg_postinst_${PN}-update () {
#!/bin/sh
if [ -n "$D" ]; then
exit 0
fi
${sbindir}/update-passwd
}

which (naturally) doesn't use the "-e" option :-). anyway, what does one suggest for consistency across the manual and code base?

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#2 lore raw
Quoted 24 lines · Robert P. J. Day
Quoted 4 lines · Robert P. J. Day

more manual pedantry -- dev manual, section 5.3.16, suggests:

A post-installation function has the following structure:

Quoted 8 lines
     pkg_postinst_PACKAGENAME() {
     #!/bin/sh -e
     # Commands to carry out
     }

except that every example of a pkg_postinst() script i've ever seen does not contain that initial hash-bang line, so the manual should at least be reworded to be consistent with the code base.

i take it back, i just ran across this example in base-passwd.bb:

pkg_postinst_${PN}-update () {
#!/bin/sh
if [ -n "$D" ]; then
exit 0
fi
${sbindir}/update-passwd
}

Quoted 2 lines

which (naturally) doesn't use the "-e" option :-). anyway, what does one suggest for consistency across the manual and code base?

Let me be the first (of many, no doubt!) to suggest:

#!/bin/bash

*ducks* :-)

#3 lore raw
Quoted 28 lines · Trevor Woerner
Quoted 24 lines · Robert P. J. Day
Quoted 4 lines · Robert P. J. Day

more manual pedantry -- dev manual, section 5.3.16, suggests:

A post-installation function has the following structure:

Quoted 8 lines
     pkg_postinst_PACKAGENAME() {
     #!/bin/sh -e
     # Commands to carry out
     }

except that every example of a pkg_postinst() script i've ever seen does not contain that initial hash-bang line, so the manual should at least be reworded to be consistent with the code base.

i take it back, i just ran across this example in base-passwd.bb:

pkg_postinst_${PN}-update () {
#!/bin/sh
if [ -n "$D" ]; then
exit 0
fi
${sbindir}/update-passwd
}

Quoted 2 lines

which (naturally) doesn't use the "-e" option :-). anyway, what does one suggest for consistency across the manual and code base?

Quoted 6 lines

Let me be the first (of many, no doubt!) to suggest:

#!/bin/bash

*ducks* :-)

"you're a funny guy, sully ... i'll kill you last." :-)

on a serious note, however, the documentation really should agree with the code, one way or the other, someone can just pick a standard and go with that. onward ...

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================