busybox extras

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

#31 Post by Ibidem »

scsijon wrote:thank you ibidem,

I was was leading to the idea that maybe we should add toybox to our 'standard puppy' like aborigonal and others have done to extend some commands without having to use the 'full' command due to lack of functionality with the current busybox's version of a command. It may even allow us to remove some of the full commands we use now.

Alternately, the busybox group maybe need to revisit it's command set and extend a number of them with what users actually now need to have.

My apologies technosaurus for taking your ropic off-topic.

regards to all
What are the BB-NOTUSED applets? Currently on Debian, and I also use a pure busybox system (ie busybox, no gnu coreutils, no fileutils, no utils-linux, no extra text editor, no gnu sed, no gawk, ...), so I can't check atm.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#32 Post by Karl Godt »

bash-3.00#

Code: Select all

for i in /bin /sbin /usr/bin /usr/sbin ; do find $i -type l -iname "*notused"; done
/bin/cp-BB-NOTUSED
/bin/rm-BB-NOTUSED
/bin/sh-BB-NOTUSED
/bin/uname-BB-NOTUSED
/bin/cat-BB-NOTUSED
/bin/mount-BB-NOTUSED
/bin/chmod-BB-NOTUSED
/bin/ps-BB-NOTUSED
/bin/ln-BB-NOTUSED
/bin/head-BB-NOTUSED
/bin/ls-BB-NOTUSED
/bin/df-BB-NOTUSED
/bin/stat-BB-NOTUSED
/bin/dd-BB-NOTUSED
/bin/umount-BB-NOTUSED
/bin/touch-BB-NOTUSED
/bin/sleep-BB-NOTUSED
/bin/mv-BB-NOTUSED
/bin/rmdir-BB-NOTUSED
/bin/xargs-BB-NOTUSED
/sbin/insmod-BB-NOTUSED
/sbin/reboot-BB-NOTUSED
/sbin/mkswap-BB-NOTUSED
/sbin/man-BB-NOTUSED
/sbin/hwclock-BB-NOTUSED
/sbin/lsmod-BB-NOTUSED
/sbin/modprobe-BB-NOTUSED
/sbin/rmmod-BB-NOTUSED
/sbin/fdisk-BB-NOTUSED
/sbin/poweroff-BB-NOTUSED
/usr/bin/find-BB-NOTUSED
/usr/bin/cut-BB-NOTUSED
/usr/bin/uniq-BB-NOTUSED
/usr/bin/sort-BB-NOTUSED
/usr/bin/od-BB-NOTUSED
/usr/bin/head-BB-NOTUSED
/usr/bin/du-BB-NOTUSED
/usr/bin/xargs-BB-NOTUSED
/usr/bin/tac-BB-NOTUSED
/usr/bin/cmp-BB-NOTUSED
/usr/sbin/setfont-BB-NOTUSED
bash-3.00#

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#33 Post by Karl Godt »

Am a fan of busybox modprobe , its missing the -D --show-depends option i think . I hate modprobe[-FULL] !

Some are scripts to adjust vars ie reboot, poweroff, df , calling busybox applets in them .
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

#34 Post by Ibidem »

Karl Godt wrote:Am a fan of busybox modprobe , its missing the -D --show-depends option i think . I hate modprobe[-FULL] !

Some are scripts to adjust vars ie reboot, poweroff, df , calling busybox applets in them .
(bb=busybox)
bb modprobe (without "simplified modutils") has -D since at least 1.20.2.
...Does Barry disable "simplified modutils" ?

sh I can see the reason for.
man is replaced with a script + browser (not my own preference, but...)
lsmod I see no logic to: neither bb nor standard has any options.
similar with sleep;
for rmdir bb lacks "--verbose".
for head bb lacks long options and metric units.
...

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#35 Post by sunburnt »

As I understand it... Puppy`s BusyBox isn`t compiled for Puppy.
So Barry disables the BusyBox links and uses the exec. files instead.

BusyBox could be built with the full exec. files instead of the trimmed down ones.
And probably many other apps. could be included; file browser, media player, etc.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#36 Post by technosaurus »

The biggest difference is to configure with :
Prefer applets
Standalone shell
Run nofork applets directly

There are several options to prefer speed over size, desktop options etc...

Its also useful to change some applets to nofork ... mknod as nofork can cut boot time in half.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#37 Post by musher0 »

Hi.

Me grouching again.

Another thing: the busybox cal function always begins the week on Mondays.
I believe half the world finds it less confusing when their week begins on a Sunday.

Maybe the code for busybox cal is a few lines of code shorter that way, but what's
the motive behind ignoring the Christian tradition of beginning the week on a Sunday?
Annoying people?

No one with even a small exposure to social sciences -- better still: nobody tactful --
would have done that.

Developers : please re-instate the full cal in the next Puppy or in your next derivative.

My 2 cents. BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#38 Post by amigo »

Here in Germany, the first day of the week -by law- is Monday. This was probably done to clear up a glaring inconsistency in modern Christianity -namely, if one is supposed to observe the 'Sabbath', why is Sunday the Holy Day? Having Monday as the first day of the week makes Sunday the last day of the week.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#39 Post by Karl Godt »

Code: Select all

bash-3.00# cal
     June 2013
Su Mo Tu We Th Fr Sa
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
bash-3.00# which cal
/bin/cal
bash-3.00# file /bin/cal
/bin/cal: symbolic link to `busybox'
bash-3.00# busybox |head -n2
BusyBox v1.19.4 (2012-04-19 16:14:01 GMT+1) multi-call binary.
Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko
bash-3.00# 
My BB cal currently defaults to Sunday as first day of the week .

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Begin of Week

#40 Post by L18L »

Code: Select all

# cal
     Juni 2013
So Mo Di Mi Do Fr Sa  
Users: Use osmo if you like to see your weekend include Sunday :lol:

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#41 Post by Karl Godt »

It's actually haymonth here . With 12 days-week . 1 day for the god of work . 11 days free . :D

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#42 Post by musher0 »

:oops: (see picture)
Maybe it depends on the locale parameters that you use?
Still, the real cal offers more choices...
Attachments
I'll_have_to_eat_my_socks.jpg
(61.05 KiB) Downloaded 450 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MinHundHettePerro
Posts: 852
Joined: Thu 05 Feb 2009, 22:22
Location: SE

#43 Post by MinHundHettePerro »

Hello :)!

Speaking of cal, I'm completely lost when I see one of those calendars beginning the week with Sunday. Therefore, I usually patch busybox cal to display Monday as the first day of the week (sorry, no choice of Sun or Mon - not a C-programmer :oops: ), like:

Code: Select all

diff -ruNt busybox-1.19.4_orig/coreutils/cal.c busybox-1.19.4/coreutils/cal.c
--- busybox-1.19.4_orig/coreutils/cal.c	2012-02-04 20:24:55.000000000 +0100
+++ busybox-1.19.4/coreutils/cal.c	2012-02-11 01:51:33.000000000 +0100
@@ -139,7 +139,7 @@
                 month_names[i] = xstrdup(buf);
 
                 if (i < 7) {
-                        zero_tm.tm_wday = i;
+                        zero_tm.tm_wday = i + 1; /* MHHP: + 1, for Monday as first day of the week */
                         /* abbreviated weekday name according to locale */
                         strftime(buf, sizeof(buf), "%a", &zero_tm);
 #if ENABLE_UNICODE_SUPPORT
@@ -264,7 +264,7 @@
          * 3 Sep. 1752 through 13 Sep. 1752.  Returns Thursday for all
          * missing days.
          */
-        temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1) + day;
+        temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1) + day - 1; /* MHHP: - 1, for Monday as first day of the week */
         if (temp < FIRST_MISSING_DAY) {
                 dw = ((temp - 1 + SATURDAY) % 7);
         } else {
Fwiw :)/
MHHP
[color=green]Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285[/color]
Slackos & 214X, ... and Q6xx
[color=darkred]Nämen, vaf....[/color] [color=green]ln -s /dev/null MHHP[/color]

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#44 Post by Karl Godt »

I don't use cal , used it in /sbin/init to compute variables for scheduled file system check .

Really horror to use cal in scripts with that "Ooh the poor not paying anything user needs a pretty output" .

one month one line --option

like -m for machine readable

2013 06:June 01:watday 02:disday 03:dongsday ...

would be really helpful
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

cal

#45 Post by L18L »

Karl Godt wrote:2013 06:June 01:watday 02:disday 03:dongsday ...

would be really helpful

Code: Select all

f=/tmp/bla;echo;date "+%Y %m:%B">$f;m=`cat $f`;y=${m:0:4};m=${m:5:2};for i in `seq 31`;do date -d $y-$m-$i "+%d:%A">>$f 2>/dev/null;done;grep -v '-' $f|tr '\n' ' ';echo

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Re: cal

#46 Post by musher0 »

L18L wrote:
Karl Godt wrote:2013 06:June 01:watday 02:disday 03:dongsday ...

would be really helpful

Code: Select all

f=/tmp/bla;echo;date "+%Y %m:%B">$f;m=`cat $f`;y=${m:0:4};m=${m:5:2};for i in `seq 31`;do date -d $y-$m-$i "+%d:%A">>$f 2>/dev/null;done;grep -v '-' $f|tr '\n' ' ';echo
Hi, L18L.

Interesting, this "one-liner". With the tr \n removed, it can form the basis of a quick and easy agenda in txt format. (168 bytes rather than 1Mb for osmo!)

Thanks for the hunch.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: re: cal for Karl

#47 Post by L18L »

technosaurus,
apologies for derailing your thread :oops: :cry:
musher0 wrote:... (168 bytes rather than 1Mb for osmo!)...
:arrow: Why osmo and not compare with minixcal :?: [edit] size: 8556B [/edit] :wink:
Last edited by L18L on Wed 19 Jun 2013, 11:58, edited 2 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Re: re: cal for Karl

#48 Post by musher0 »

L18L wrote:technosaurus,
apologies for derailing your thread :oops: :cry:
musher0 wrote:... (168 bytes rather than 1Mb for osmo!)...
:arrow: Why osmo and not compare with minixcal :?: :wink:
L18L,

That's because the comparison with the size of minixcal (8,556Kb) would
not "hit" the imagination as much! :wink: (Ouch, someone's imagination was hit!) :)

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

#49 Post by Ibidem »

musher0 wrote::oops: (see picture)
Maybe it depends on the locale parameters that you use?
Still, the real cal offers more choices...
The REAL cal does not: http://pubs.opengroup.org/onlinepubs/96 ... s/cal.html
You seem to have fallen for the GNU fallacy that "number of features" == "how good it is".
In reality, there are several factors in determining quality:
(1) Features
a-some features that everyone needs
b-some features that vastly improve things for many people
c-some features that are used once in a while
d-some features that are actively harmful
(2) How stable the implementation is
(3) size of the implementation

Busybox focuses on 2 & 3, implementing the features that are needed rather than "everything that everyone has ever done".
Additionally, Busybox is oriented towards following standards.

In GNU software, I frequently run across options and interfaces that were peculiar to DEC or Sun tools and libraries in the 1990's, perpetuated by GNU's cruft accumulation. I run across behavior that will break a POSIX-conformant script, with a long option like --posix to turn on "conformant" behavior...except that --posix is not specified and is thus neither portable nor conformant.
Look at the output of this on Debian:

Code: Select all

$ { echo 0; { for cmd in `busybox |sed -ne 's/,/\n/gp' |grep -v xz`; do size `command -v $cmd` 2>/dev/null |tail -n 1; done; }|awk '{print  $4 " + "}';echo p; }|busybox dc
12215080
That's TWELVE MEGABYTES even with several applets having no equivalent installed, and I can build a static busybox with that and more in less than one megabyte:

Code: Select all

$ ./busybox; ls -l busybox
BusyBox v1.22.0.git (2013-06-12 22:24:54 PDT) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --install [-s] [DIR]
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

Currently defined functions:
        [, [[, acpid, add-shell, addgroup, adduser, adjtimex, ar, arp, ash,
        awk, base64, basename, bash, bbconfig, beep, blkid, blockdev,
        bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr,
        chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear,
        cmp, comm, conspy, cp, cpio, crond, crontab, cryptpw, cttyhack, cut,
        date, dc, dd, deallocvt, delgroup, deluser, depmod, devmem, df,
        dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, dpkg,
        dpkg-deb, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env,
        envdir, envuidgid, expand, expr, fakeidentd, false, fbset, fbsplash,
        fbvnc, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs,
        flash_eraseall, flash_lock, flash_unlock, flashcp, flock, fold, free,
        freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser,
        getopt, getty, grep, groups, guess_fs, gunzip, gzip, halt, hd, hdparm,
        head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig,
        ifdown, ifenslave, ifplugd, ifup, inetd, init, inotifyd, insmod,
        install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink,
        iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd,
        less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login,
        logname, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lsof,
        lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man,
        md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mke2fs, mkfifo,
        mkfs.ext2, mkfs.minix, mkfs.reiser, mkfs.vfat, mknod, mkpasswd, mkswap,
        mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, msh, mv,
        nameif, nanddump, nandwrite, nbd-client, nc, netstat, nice, nmeter,
        nohup, nroff, nslookup, ntpd, od, openvt, passwd, patch, pgrep, pidof,
        ping, ping6, pipe_progress, pivot_root, pkill, pmap, popmaildir,
        poweroff, powertop, printenv, printf, ps, pscan, pstree, pwd, pwdx,
        raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath,
        reboot, reformime, remove-shell, renice, reset, resize, rev, rfkill,
        rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runsv,
        runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setarch,
        setconsole, setfont, setkeycodes, setlogcons, setserial, setsid,
        setuidgid, sh, sha1sum, sha256sum, sha3sum, sha512sum, showkey,
        slattach, sleep, smemcap, softlimit, sort, split, start-stop-daemon,
        stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon,
        switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee,
        telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr,
        traceroute, traceroute6, true, tty, ttysize, tunctl, tune2fs,
        ubiattach, ubidetach, ubimkvol, ubirmvol, ubirsvol, ubiupdatevol,
        udhcpc, udhcpc6, udhcpd, udpsvd, umount, uname, uncompress, unexpand,
        uniq, unix2dos, unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode,
        uuencode, vconfig, vi, vlock, volname, watch, watchdog, wc, wget,
        which, whoami, whois, xargs, xz, xzcat, yes, zcat, zcip

-rwxr-xr-x 1 ibid ibid 947304 Jun 12 23:01 busybox
...OK, sorry for the rant.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#50 Post by Karl Godt »

, and I can build a static busybox with that and more in less than one megabyte:
http://busybox.net/downloads/busybox-snapshot.tar.bz2
Without pam and dmalloc mine is
bash-3.00# ls -l ./busybox
-rwxr-xr-x 1 root root 1939492 2013-06-19 11:28 ./busybox
the double size .
Upx'd would be 50% ~ 1MB estimated .

Use full modutils , disabled pretty output for lsmod and dmesg .

Had o switch the header directory /usr/include from the current upgraded one to the Puppy-4 kernel 2.6.30.5 /usr/include for
miscutils/adjtimex.c: In function ‘adjtimex_main’:
miscutils/adjtimex.c:92: Fehler: ‘ADJ_OFFSET_SINGLESHOT’ undeclared (first use in this function)

then switch back to the current for
miscutils/rfkill.c:23:26: error: linux/rfkill.h: No such file or directory

and finally switch to Lupu-5.1.1 /usr/include for
miscutils/ubi_tools.c:67:26: error: mtd/ubi-user.h: No such file or directory

.

Post Reply