Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use bash from $PATH #776

Merged
merged 1 commit into from Apr 4, 2023
Merged

use bash from $PATH #776

merged 1 commit into from Apr 4, 2023

Conversation

milahu
Copy link

@milahu milahu commented Apr 4, 2023

fix build on nixos linux
where bash is installed in /nix/store/

@fda77
Copy link

fda77 commented Apr 4, 2023

There are many places wiht hardcoded /bin/bash (some are related to the shell on the device, not host):

./tools/freetz_revision:#!/bin/bash
./tools/reuseconfig:#! /bin/bash
./tools/freetz_download:#!/bin/bash
./tools/prerequisites:#!/bin/bash
./tools/verify-dls.sh:#!/bin/bash
./tools/developer/big-makefile:#!/bin/bash
./tools/developer/remove_js_function.sh:#!/bin/bash
./tools/developer/create-kconfig-warnings:#!/bin/bash
./tools/freetz_bin_functions:#!/bin/bash
./tools/juis_check:#!/bin/bash
./tools/visualise_make:#!/bin/bash
./tools/external:#!/bin/bash
./tools/genin:#!/bin/bash
./tools/reuseconfig-internal:#! /bin/bash
./tools/dl-toolchains_make:#!/bin/bash
./tools/fwdu-opensrc:#!/bin/bash
./tools/fit.sh:#!/bin/bash
./tools/avm_kernel_config.extract.sh:#!/bin/bash
./tools/freetz_functions:#!/bin/bash
./tools/extract-images:#!/bin/bash
./tools/dl-hosttools:#!/bin/bash
./tools/freetz_patch:#!/bin/bash
./tools/unpack-kernel:#!/bin/bash
./tools/fwdu:#!/bin/bash
./tools/juis:#!/bin/bash
./tools/remove-nmi-vector:#!/bin/bash
./tools/dl-toolchains_eval:#!/bin/bash
./tools/vanilla.sh:#!/bin/bash
./tools/lib_report:#!/bin/bash
./tools/scriptpatcher.sh:#!/bin/bash
./tools/image2inmemory:#!/bin/bash
./tools/freetz_mklibs:#!/bin/bash
./tools/push_firmware:#!/bin/bash
./fwmod_custom:#!/bin/bash
./fwmod:#!/bin/bash
./docs/PREREQUISITES/generate.sh:#!/bin/bash
./docs/generate.sh:#!/bin/bash
./docs/patches/generate.sh:#!/bin/bash
./docs/make/generate.sh:#!/bin/bash
./docs/make/README.md:    Subshell support means you can press Ctrl-O to hide the mc panels and have a real subshell. Both Bash (if package is installed) and BusyBox Ash can be used, depending which one is defined as your login shell. ATTENTION: You should *not* use CONFIG_FEATURE_BASH_IS_ASH in BusyBox or otherwise symlink /bin/bash to /bin/busybox because MC must differentiate handling between Ash and real Bash. This feature adds about 8 KB (uncompressed) to the mc binary.
./docs/libs/generate.sh:#!/bin/bash
./docs/CHANGELOG.md:        (use bash login shell or call "SHELL=/bin/bash mc" to get bash subshell)
./docs/CHANGELOG.md:    * Add "SHELL:=/bin/bash" to Makefile because of this:
./docs/juis/generate.sh:#!/bin/bash
./docs/wiki/30_Expert/rudi_shell.md:    #!/bin/bash
./docs/wiki/30_Expert/make_room.md:     $ echo '#!/bin/bash' > before-after-script
./docs/wiki/generate.sh:#!/bin/bash
./docs/screenshots/generate.sh:#!/bin/bash
./patches/scripts/700-add_bash_to_shells.sh:grep -q "^/bin/bash$" "${FILESYSTEM_MOD_DIR}/etc/shells" >/dev/null 2>&1 || ( echo "/bin/bash" >> "${FILESYSTEM_MOD_DIR}/etc/shells" )
./Makefile:SHELL:=/bin/bash
./make/kernel/configs/diff-configs.sh:#!/bin/bash
./make/kernel/configs/avm2freetz.sh:#!/bin/bash
./make/kernel/patches/2.6.32.41/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/2.6.39.3.x86/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.1.52/7539_07.29/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.1.52/7539_07.22/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.4.60/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.250.x86/6660_07.26/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.218/5530_07.21/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.218/7590_07.50/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.198/7590_07.25/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.198/7590_07.20/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/3.10.73/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/3.12.74.x86/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/3.10.12/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.279.x86/6591_07.50/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/2.6.28.10/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/2.6.28.10/209-mini_fo.patch:+#!/bin/bash
./make/kernel/patches/2.6.28.10/209-mini_fo.patch:+#!/bin/bash
./make/kernel/patches/2.6.28.10/7390_06.80/000-7390.06.80-7390.06.86-delta.patch:-#! /bin/bash
./make/kernel/patches/2.6.13.1/209-mini_fo.patch:+#!/bin/bash
./make/kernel/patches/2.6.13.1/209-mini_fo.patch:+#!/bin/bash
./make/kernel/patches/2.6.32.60/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/2.6.19.2/209-mini_fo.patch:+#!/bin/bash
./make/kernel/patches/2.6.19.2/209-mini_fo.patch:+#!/bin/bash
./make/kernel/patches/3.12.59.x86/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/2.6.39.4.x86/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/3.10.104/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.199.x86/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.175.x86/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/4.9.231/5530_07.29/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/2.6.32.61/010-shell_bash.patch:+SHELL := /bin/bash
./make/kernel/patches/3.10.107/010-shell_bash.patch:+SHELL := /bin/bash
./make/host-tools/kconfig-host/patches/100-main_makefile.patch:+          else if [ -x /bin/bash ]; then echo /bin/bash; \
./make/libs/ncurses/generate.sh:#!/bin/bash
./make/pkgs/bash/bash.mk:$(PKG)_TARGET_BINARY:=$($(PKG)_DEST_DIR)/bin/bash
./make/pkgs/bash/external.in:            /bin/bash (only use, if init!=/bin/bash)
./make/pkgs/bash/external.files:[ "$EXTERNAL_FREETZ_PACKAGE_BASH" == "y" ] && EXTERNAL_FILES+=" /bin/bash"
./make/pkgs/juis_check/src/configure:#!/bin/bash
./make/pkgs/owfs/patches/120-invalid-tags-ltmain.patch:-SHELL="/bin/bash"
./make/pkgs/README.md:    Subshell support means you can press Ctrl-O to hide the mc panels and have a real subshell. Both Bash (if package is installed) and BusyBox Ash can be used, depending which one is defined as your login shell. ATTENTION: You should *not* use CONFIG_FEATURE_BASH_IS_ASH in BusyBox or otherwise symlink /bin/bash to /bin/busybox because MC must differentiate handling between Ash and real Bash. This feature adds about 8 KB (uncompressed) to the mc binary.
./make/pkgs/microperl/patches/100-static_uudmap.patch:+#!/bin/bash
./make/pkgs/openssl/patches/1.0/120-makedepend_using_bash.openssl.patch:+#!/bin/bash
./make/pkgs/openssl/patches/0.9/120-makedepend.openssl.patch:+#!/bin/bash
./make/pkgs/mc/Config.in:                       or otherwise symlink /bin/bash to /bin/busybox because MC must
./make/pkgs/dehydrated/files/root/etc/default.dehydrated/dehydrated_conf:#!/bin/bash
./make/busybox/generate.sh:#!/bin/bash
./make/busybox/patches/1.36/130-scripts_bash.patch:+#!/bin/bash
./make/busybox/patches/1.36/130-scripts_bash.patch:+#!/bin/bash
./make/busybox/patches/1.27/130-scripts_bash.patch:+#!/bin/bash
./make/busybox/patches/1.27/130-scripts_bash.patch:+#!/bin/bash
./make/busybox/Config.in.busybox.1_27:    /bin/bash (sym)link and run scripts which start with
./make/busybox/Config.in.busybox.1_27:    #!/bin/bash line.
./make/busybox/Config.in.busybox.1_36:  /bin/bash (sym)link and run scripts which start with
./make/busybox/Config.in.busybox.1_36:  #!/bin/bash line.
./fmake:#!/bin/bash
./fmake:#!/bin/bash
./.github/docker/.build.sh:#!/bin/bash
./.github/docker/dl-packs/entrypoint.sh:#!/bin/bash
./.github/docker/generate/entrypoint.sh:#!/bin/bash
./.github/docker/firmware/entrypoint.sh:#!/bin/bash
./config/.kos/generate.sh:#!/bin/bash
./config/.img/generate.sh:#!/bin/bash

@fda77
Copy link

fda77 commented Apr 4, 2023

A quick fix is to check /bin/bash and show an error if it does not exists. Changing all places may cause (likely) new problems

@milahu
Copy link
Author

milahu commented Apr 4, 2023

Changing all places may cause (likely) new problems

never change a running system? ; )

the standard portable way is #!/usr/bin/env bash
(this also works on nixos linux without calling patchShebangs)

@fda77
Copy link

fda77 commented Apr 4, 2023

never change a running system? ; )

yes, when it costs my time ^^

even when everything in freetz is changed, there are still the (crappy) avm sources.
eg 7390 06.80 uses /bin/bash in init_capi_codec
in 7390 06.86 it was changed to /bin/sh what does not help you

So if build works depends on the packages you select

@fda77
Copy link

fda77 commented Apr 4, 2023

@milahu:
good news: i've replace everything i found (which is for sure not everything)
bad news: fwmod does not work anymore (fakeroot detection is broken) at all and i have no more time now
maybe you could fix it

@milahu
Copy link
Author

milahu commented Apr 4, 2023

Makefile of freetz is really the only place where fixing makes sense, so ... please merge?

(SHELL:=bash CC:=gcc etc is also standard in makefiles, absolute paths are less portable)

(i can use patchShebangs on nixos to autofix the shebang lines)

(fixing AVM/linux sources is out of scope)

@fda77
Copy link

fda77 commented Apr 4, 2023

Makefile of freetz is really the only place where fixing makes sense

lol, no
first the fakeroot problem should be fixed

@fda77 fda77 merged commit f147dab into Freetz-NG:master Apr 4, 2023
@milahu
Copy link
Author

milahu commented Apr 5, 2023

i mean ...

good news: i've replace everything i found (which is for sure not everything)
bad news: fwmod does not work anymore (fakeroot detection is broken) at all and i have no more time now

no need to patch these /bin/bash references
so we dont have "the fakeroot problem" in the first place

using /bin/bash on runtime (on the router) is okay
im only talking about compile time (on my build machine)

anyway, thanks : )

@fda77
Copy link

fda77 commented Apr 5, 2023

You really need /bin/bash for the avm parts (kernel). Freetz should have all static paths changed.
If you want to skip the error message, just remove the 1 line form .prerequisites

@switch-gott
Copy link

You meen this line?
program aclocal FREETZ_PACKAGE_GNTPSEND

Any other option to get the make process working again?

@fda77
Copy link

fda77 commented Apr 5, 2023

Never worked everything without /bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants