hamishcoleman / debian-minimal-builder

Tool for creating minimal installs of debian-based systems
GNU General Public License v2.0
21 stars 11 forks source link

Shellcheck failing #9

Closed benhylau closed 5 years ago

benhylau commented 5 years ago

I am getting these shellcheck failures. Are you not getting these?

shellcheck scripts/packages.addextra scripts/packages.runscripts scripts/configdir_deps scripts/authorized_keys_local scripts/authorized_keys_path multistrap.configscript policy-rc.d packages.d/*.minimise packages.d/*.fixup  packages.d/_ALWAYS.fixup.add/init packages.d/_ALWAYS.fixup.add/init.d/* packages.d/_ALWAYS.fixup.add/usr/local/sbin/config_save packages.d/hostapd.customise.add/usr/local/sbin/hostapd.template packages.d/systemd.customise.add/usr/local/sbin/mesh.setup packages.d/systemd.customise.add/usr/local/sbin/udc.setup

In scripts/packages.addextra line 41:
PACKAGES=$(dpkg-query --admindir="${DEBOOT}/var/lib/dpkg" --show --showformat="${Package}\n")
                                                                               ^-- SC2154: Package is referenced but not assigned (did you mean 'package'?).

In packages.d/screen.fixup line 12:

^-- SC1072: No command. Fix any mentioned problems and try again.

Makefile:70: recipe for target 'shellcheck' failed
make[1]: *** [shellcheck] Error 1
make[1]: Leaving directory '/home/b/mesh-orange/debian'
Makefile:39: recipe for target 'test' failed
make: *** [test] Error 2
hamishcoleman commented 5 years ago

I'm not getting those errors here - I tried with two shellcheck versions, both from debian - version 0.4.7-1 and 0.5.0-3 - which version is giving you these errors?

Additionally, these are both bogus reports - the first one looks like a bug in shellcheck and the second one is just stupid.

Either way, try it with these two patches

benhylau commented 5 years ago

I downloaded the latest xenial ubuntu-16.04.5-server-amd64.iso to spin up a local VM, that's the one giving me these errors. The xenial environment on travis does not complain about these.

I basically used the same patches to get things to build on my VM yesterday. One thing that happened was after applying the SC2154 ignore is this:

In scripts/packages.addextra line 44:
PACKAGES=$(dpkg-query --admindir="${DEBOOT}/var/lib/dpkg" --show --showformat='${Package}\n')
                                                                              ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.

So ignoring SC2016 only fixes it, you do not need to ignore SC2154:

# shellcheck disable=SC2016

I have tested your exact patches and the same happened.

hamishcoleman commented 5 years ago

I dont know what version of shellcheck is included with ubuntu xenial, but testing with older versions will not produce valid results. Also, testing with Ubuntu is known to have issues, so don't do that either.

I have updated the documentation and CI setup to clearly specify that this builder should be used with Debian (It /is/ building a debian system, so this is not unexpected)