busybox with single applet enabled

Sergey Naumov sknaumov at gmail.com
Sat May 21 18:33:28 UTC 2011


> I propose that we at least make "fuller" config (one with more options
> set to "yes") work properly:
>
> +               /* Add user to his own group with the first free gid
> +                * found in passwd_study.
> +                * We try to use --gid, not -g, because "standard" addgroup
> +                * has no such short option, it has only long --gid.
> +                */
> +#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS
> +               argv[1] = (char*)"--gid";
> +#else
>                argv[1] = (char*)"-g";
> +#endif
>
> If FEATURE_ADDGROUP_LONG_OPTIONS=y, this will work with any "addgroup" -
> busybox or standard. If FEATURE_ADDGROUP_LONG_OPTIONS!=y, then user
> takes responsibility to ensure that "addgroup" on his system comes from bbox.

That will not work if addgroup is disabled.

This is better I think:
#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS || ! ENABLE_ADDGROUP
        argv[1] = (char*)"--gid";
#else
        /* applet is enabled, but without long options
         * here we can try to directly call applet within busybox
         * if FEATURE_PREFER_APPLETS is disabled
         * to ensure correct work if applet is not installed,
         * but that will bloat the code
         */
         argv[1] = (char*)"-g";
#endif

Sergey Naumov.


More information about the busybox mailing list