Permalink
Browse files

Adding manual pages

  • Loading branch information...
1 parent 440e2b6 commit 7b30aa2a1dca3a1d8313025c3e182dce0ea427be @geirha committed Sep 22, 2012
Showing with 71 additions and 22 deletions.
  1. +10 −1 build-adu
  2. +11 −6 build-awk
  3. +4 −2 build-bash
  4. +3 −2 build-ex-vi
  5. +3 −2 build-mksh
  6. +14 −6 evalcmd
  7. +24 −3 generate-initramfs
  8. +2 −0 manpages
View
11 build-adu
@@ -5,4 +5,13 @@ cd build/adu &&
wget -c -O "../adu.tar.Z" "http://twkm.freeshell.org/adu.tar.Z" &&
compress -cd "../adu.tar.Z" | pax -r &&
make -f adu.mak &&
-cp adu ../bin
+cp adu ../bin &&
+
+md5=$(openssl md5 < adu.txt) md5=${md5##* } &&
+source ../../manpages &&
+if [[ $md5 != "${md5s[adu]}" ]]; then
+ md5s[adu]=$md5
+ urls[adu]=$(curl -F 'sprunge=<-' http://sprunge.us < adu.txt|tr -d ' ') &&
+ declare -p md5s urls > ../../manpages.new &&
+ mv ../../manpages{.new,}
+fi
View
17 build-awk
@@ -2,7 +2,7 @@
awk=$1 version=$2 bin_name=${3:-$1$2}
-mkdir -p build/bin &&
+mkdir -p build/{bin,man/man1} &&
cd build &&
case $awk in
bwk)
@@ -11,7 +11,8 @@ case $awk in
cd bwk &&
gzip -cd ../bwk.tar.gz | pax -r &&
make CFLAGS=-D_POSIX_C_SOURCE=200112L &&
- cp a.out ../bin/bwk
+ cp a.out ../bin/bwk &&
+ cp awk.1 ../man/man1/bwk.1
;;
oawk)
wget -c -O heirloom-070715.tar.bz2 http://sourceforge.net/projects/heirloom/files/heirloom/070715/heirloom-070715.tar.bz2/download &&
@@ -21,30 +22,34 @@ case $awk in
make -C libcommon &&
make -C libuxre &&
make -C oawk &&
- cp oawk/awk ../bin/oawk
+ cp oawk/awk ../bin/oawk &&
+ cp oawk/oawk.1 ../man/man1/oawk.1
;;
nawk)
wget -c -O nawk.tar.gz http://www.cs.princeton.edu/~bwk/btl.mirror/awk.tar.gz &&
mkdir -p nawk &&
cd nawk &&
gzip -cd ../nawk.tar.gz | pax -r &&
make &&
- cp a.out ../bin/nawk
+ cp a.out ../bin/nawk &&
+ cp awk.1 ../man/man1/nawk.1
;;
gawk)
wget -c -O "gawk-$version.tar.gz" "http://ftp.gnu.org/gnu/gawk/gawk-$version.tar.gz" &&
gzip -cd "gawk-$version.tar.gz" | pax -r &&
cd "gawk-$version" &&
./configure &&
make &&
- cp gawk "../bin/$bin_name"
+ cp gawk "../bin/$bin_name" &&
+ cp doc/gawk.1 "../man/man1/$bin_name.1"
;;
mawk)
wget -c -O mawk.tar.gz http://invisible-island.net/datafiles/release/mawk.tar.gz &&
gzip -cd mawk.tar.gz | pax -rs '|^[^/]*|mawk|' &&
cd mawk &&
./configure &&
make &&
- cp mawk ../bin/mawk
+ cp mawk ../bin/mawk &&
+ cp man/mawk.1 ../man/man1/mawk.1
;;
esac
View
6 build-bash
@@ -3,13 +3,14 @@ shopt -s extglob
version=$1 bin_name=${2:-bash$version}
-mkdir -p build/bin &&
+mkdir -p build/{bin,man/man1} &&
if [[ $version = devel ]]; then
mkdir -p build/loadables &&
cd bash &&
./configure &&
make &&
cp bash "../build/bin/$bin_name" &&
+ cp doc/bash.1 "../build/man/man1/$bin_name.1" &&
# loadable builtins
cd examples/loadables &&
make &&
@@ -116,4 +117,5 @@ fi
./configure "${configure_opts[@]}" &&
make &&
-cp bash "../bin/$bin_name"
+cp bash "../bin/$bin_name" &&
+cp doc?(umentation)/bash.1 "../man/man1/$bin_name.1"
View
5 build-ex-vi
@@ -1,9 +1,10 @@
#!/bin/bash
-mkdir -p build/bin &&
+mkdir -p build/{bin,man/man1} &&
cd build &&
wget -c -O ex-vi.tar.bz2 "http://sourceforge.net/projects/ex-vi/files/latest/download" &&
bzip2 -cd ex-vi.tar.bz2 | pax -rs ',[^/]*,ex-vi,' &&
cd ex-vi &&
make &&
-cp ex ../bin
+cp ex ../bin &&
+cp ex.1 ../man/man1/ex.1
View
5 build-mksh
@@ -2,11 +2,12 @@
version=$1 bin_name=${2:-mksh$version}
-mkdir -p build/bin &&
+mkdir -p build/{bin,man/man1} &&
cd build &&
wget -c -O "mksh-$version.tgz" "https://www.mirbsd.org/MirOS/dist/mir/mksh/snapshot/mksh-$version.tgz" &&
gzip -cd "mksh-$version.tgz" | pax -r &&
cd mksh &&
sh Build.sh &&
-cp mksh "../bin/$bin_name"
+cp mksh "../bin/$bin_name" &&
+cp mksh.1 "../man/man1/$bin_name.1"
View
20 evalcmd
@@ -7,6 +7,14 @@ while read -r trigger shell; do
done < ./triggers
[[ ${triggers[$t]} ]] || exit
+if [[ $2 = "man "[![:blank:]]* ]]; then
+ source ./manpages
+ if [[ ${urls[${2#man }]} ]]; then
+ printf '%s: %s\n' "$2" "${urls[${2#man }]}"
+ exit
+ fi
+fi
+
output=$(./limitcmd.pl "${triggers[$t]}" "$2" | expand | head -c 4242 | tr -d '\r' | awk '{ do { print substr($0, 1, 120); $0 = substr($0, 121); } while(length($0)>0); }'; exit ${PIPESTATUS[0]}; )
result=$?
lines=$(wc -l <<< "$output")
@@ -15,12 +23,12 @@ shopt -s extglob
if [[ $output == *( ) ]]
then
- if (( result > 0 ))
- then
- echo "no output within the time limit"
- else
- echo "no output"
- fi
+ if (( result > 0 ))
+ then
+ echo "no output within the time limit"
+ else
+ echo "no output"
+ fi
exit 0
fi
View
27 generate-initramfs
@@ -224,6 +224,9 @@ case $(uname -m) in
;;
esac || exit
+source ./manpages # declare -A md5s urls
+mans_updated=0
+
for cmd in "${!commands[@]}"; do
if ! path=$(readlink -f "$(type -P "$cmd")") 2>/dev/null; then
printf >&2 'WARNING: not found: %s - %s\n' "$cmd" "${commands[$cmd]}"
@@ -244,11 +247,29 @@ done
cp build/loadables/* initramfs/usr/lib
for cmd in "${!command_paths[@]}"; do
- cp "${command_paths[$cmd]}" "initramfs/bin/$cmd"
- strip "$initramfs/bin/$cmd" 2>/dev/null
+ cp "${command_paths[$cmd]}" "initramfs/bin/$cmd" &&
+ strip "$initramfs/bin/$cmd" 2>/dev/null
+
+ {
+ MANWIDTH=80 man -l "build/man/man1/$cmd.1" ||
+ MANWIDTH=80 man "$cmd"
+ } > man.tmp 2>/dev/null || continue
+ md5=$(openssl md5 < man.tmp)
+ md5=${md5##* }
+
+ if [[ $md5 != "${md5s[$cmd]}" ]]; then
+ printf 'Updating manual for %s\n' "$cmd" >&2
+ md5s[$cmd]=$md5
+ urls[$cmd]=$(curl -F 'sprunge=<-' http://sprunge.us < man.tmp|tr -d ' ') &&
+ mans_updated=1
+ sleep 2
+ fi
done
-
+if ((mans_updated)); then
+ declare -p md5s urls > manpages.new &&
+ mv manpages{.new,}
+fi
## Some additional commands
View
2 manpages
@@ -0,0 +1,2 @@
+declare -A md5s='([recode]="49f3bdeb4aee0fe7eb7f91b5954c81fe" [renice]="98f7e1fb5889102fe803b6a9ae0f6eaa" [grep]="17947131a8efa590c90af114898caeab" [adu]="23fba33cb071142ed572ae989403cc19" [kill]="dce115f4cf84eb1a966469cd0c9c1198" [tty]="64f4dabc9c8565a72f094e792277a4ad" [pwd]="6d2b179b81925c9a94a75f4118b4d14f" [printf]="d2f190dfb1b3bdcec835ec1c58e22ed9" [false]="b44e6ee0c93932f716bbb64489cb59b6" [basename]="89b29104e061d1cf81dc18a8a0a24c27" [hostname]="de24c9b19908462b73809fb1876da11d" [time]="a16a69dafa60e1b50077323614cb982a" [mawk]="f62c37897495d7f88d947c6d5b177fc6" [cal]="9a91427630d13b8f8214c33ded799e06" [tail]="35b76876fab6799ced3b9e3ee9334935" [nl]="5a805c668c9bf9459d255bea74a9a56b" [bzip2]="2ab20540660b5f65d36633d380053f79" [xargs]="c85d41de02a925376e5f78573adbf98d" [pathchk]="21af651491bcf7499548d156692418b1" [ex]="432f4ff6bcac528b12218a8dd2f96224" [chown]="364953d5197e148b77e8d57d9605ca07" [bwk]="4e95e23a1767a8fa7899c8b6e5a15562" [umount]="ea31d65733f20c0034457e9b21c38de3" [expand]="496a32da36c863b903acf1b5f0cf51bc" [dd]="8b7f06df19d3da464857856b456133c3" [gawk4]="d09ee62e7ff8301299dc7b572e677397" [bash4]="9109f303f84e40430ea6687883384cb2" [patch]="4d8d992e00ecc077f71fd711bfca8aa2" [gencat]="fc9807c8f3c9d221ba0b19a46502a5a8" [df]="04176a1c0690eb7922f55cb748ed9c34" [nice]="4814f0ed0c2a492b63023e74faffa621" [bash2]="f366c9b9df930c8757de1c20ba566226" [tabs]="bc3a6fd11fe2769521fc2f025a30b3f9" [gawk3]="238ab329d790b035277a01140e9455a7" [bash3]="f0ba619c855240f970db5911fcb6460c" [ksh]="d4058925bddab9abe029498b7fe0b985" [bash1]="2c6985b1bf0b1245673dfd10fbd7ce9e" [rmdir]="884425967fb15d6dc5a03859ad7c9008" [nohup]="792f77dce443513dff24b18171568779" [link]="e058cf898229b77adbda044300d346f7" [join]="fe05ec2d86cb257962dabbdfcebe8924" [comm]="be7cc112e9829090fbc064921a4ba49b" [file]="fafe92ca9cbc01314e0b1af8477d9f1f" [logname]="cf7798d6921898c7731d15e72bb457b5" [sort]="3b4cd6f9f24e434af94f8ea8fc06d748" [fold]="38e7c7422a7c030196f396e382687e7f" [bash+]="a85601c66c4369997e399ee3dabca3d6" [head]="45c9bb51be42621b0ec8a83b68ce20a3" [tput]="76fabac9cdb9cc2423d05e0f4743a9c8" [uudecode]="adf33ab70a001886e230ab8aa8f00bac" [tsort]="a93e60783ba07bb6bc52de270e91478f" [od]="1a918312bab1d5eb4ec667158a4143f1" [du]="5c6fcea62acdde5114365c5f7bab4efa" [rm]="828588f9456d86e6ea302d0ce078a7bb" [pax]="2c76b51e0bf85e67372199ab747db930" [newgrp]="e79c1b5b85b062a7ebfa0945c2643724" [ed]="604e099c342150c4ba9d0c7630fb2ade" [echo]="e4fbd5b4a0e76fc3c94566819427b5af" [chmod]="a88b3b433d2aa473843b2fbe19c4fec4" ["["]="d16a949dc25276c5cbff9b6a5793f42a" [gzip]="93c095023519cb9c0ffca9b3a62e89f2" [dirname]="cad2050e174c94d4fd02fde726307ca2" [date]="5be0db282f3895ab853eb7a70f6373fc" [cat]="5f5c85e8afb69e45e9da7a794cb9e11b" [touch]="3ee6165f26dfd58cd243bc384922a780" [expr]="c81cc4228fe04be2c9993529929083f6" [diff]="03b1f4b01e6691735758db5f87ce8224" [tee]="459d0846a8ad80a7e9bcd9158396990b" [locale]="da2c7b2d7101e664aa272e70242088c1" [mount]="a0b3f6fc98a1e359ec2a44ff6e0da8aa" [split]="b8be5b5596955f94a1bf1553583e18cd" [sed]="092aff188d7108dc2c313584b829b722" [sleep]="f66010edaff24f5d2a11b6308b263d0f" [mv]="2242302cac4c2ba8a5dce0dfbbb1a1a6" [pr]="353daf592d0343d961546872391468da" [ps]="ece3f4e4d5e98781b0db841d78fd98b1" [m4]="fa3a3ad9e28607da81724afdf2699ba8" [tac]="af342e3cde3f9661cc9cbc767959934b" [dash]="5b8cd93174331dcb7dd9c5492c342c8f" [uuencode]="adf33ab70a001886e230ab8aa8f00bac" [uname]="b0e41eb8d44498bc5b96f30f1f20696a" [bc]="7321771f51b04b08b226327c498bb89f" [mktemp]="0a15e3d1772128bb4d97fb3cdfcba7d7" [who]="9b14958a933ccf7f8ddcfb0bf11869eb" [true]="7a4fa50b14a7ad7012da61099d673413" [paste]="7e626a8a9e04b0849399918ef2392d1c" [mkdir]="202e9c5e8d56db537cab03c4f20e9061" [cp]="24eb0a4171bc17adb82ff6c93330580f" [ln]="8b6ffbbe47f122c864573940807556bc" [chgrp]="c8babe63888bfac41f6a93b46b92216d" [localedef]="7f2bcd67a35b4e8b286a50166e9adc9d" [test]="d16a949dc25276c5cbff9b6a5793f42a" [cmp]="f0754fa13e96d5d768bebb6c4e312e15" [mksh]="4682c1105f54d2cfbb492de7020cb8c2" [unlink]="383124799c9e64058ec572814d4b1f2a" [uncompress]="93c095023519cb9c0ffca9b3a62e89f2" [strace]="a8794b0c1eb49b861d93cbdac0242983" [tr]="89076a6c0b7f9e4dfa3729671d67fc2e" [id]="208d0a854aab2dc132ecb6f5b1df3d0c" [stty]="8d28d62375a5a1cda441dee45bb255cb" [cut]="f7065f197f2dafc32644b804bdb9212a" [oawk]="e83edb8d46557c6545859765631a8edd" [cksum]="2af472faea132aca9b1e75a3da7c63fe" [setsid]="93a4ea2dd8ef0b2c8227eb8ca662d74f" [compress]="83fb97686dd7c26af6266a7c72955f05" [env]="f7d0787b3a5d51facbe12002efb46e6d" [csplit]="40d3d6e4d6e229425665df1e11844adb" [zcat]="93c095023519cb9c0ffca9b3a62e89f2" [wc]="401bceffcf1e8797e9202da2f6d426db" [mknod]="d68b2aba2d769ef073f83d9026eba920" [ls]="9c7b1ae91316f4df3dfd62a48377a882" [iconv]="9f4dfeefc4a745ae96b2612d4bc790ae" [fuser]="634063d286fd0b6e5018cf35c1121751" [nawk]="4e95e23a1767a8fa7899c8b6e5a15562" [unexpand]="73ab08d2d03c6170ac9fae6f8e2c72dd" [find]="151e1651db47eedc79f3fd9623dc4182" [strings]="8262b09d02730603307a8ca501685b6f" [getent]="0ac16233d5585b8df69e34c38a77bc1b" [logger]="0eb24c56661eed4b388b33f2e7d4f6db" [mkfifo]="b6dbd979de3e55299571f18e3a24d7e7" [getconf]="6b6e2d073d0ea26a0d6b32ef51fe197d" [uniq]="0b7e0033f030e27f3f713742346a26f0" )'
+declare -A urls='([recode]="http://sprunge.us/TPLY" [renice]="http://sprunge.us/fYZG" [grep]="http://sprunge.us/TUhZ" [adu]="http://sprunge.us/UCiQ" [kill]="http://sprunge.us/aLGg" [tty]="http://sprunge.us/XDYA" [pwd]="http://sprunge.us/jFBF" [printf]="http://sprunge.us/HQiC" [false]="http://sprunge.us/bZje" [basename]="http://sprunge.us/MDfa" [hostname]="http://sprunge.us/POPQ" [time]="http://sprunge.us/EgHh" [mawk]="http://sprunge.us/MSWX" [cal]="http://sprunge.us/CcJg" [tail]="http://sprunge.us/KiTC" [nl]="http://sprunge.us/SIbS" [bzip2]="http://sprunge.us/dMic" [xargs]="http://sprunge.us/XhXa" [pathchk]="http://sprunge.us/OeJb" [ex]="http://sprunge.us/PeaZ" [chown]="http://sprunge.us/EfOG" [bwk]="http://sprunge.us/aMeN" [umount]="http://sprunge.us/bfRE" [expand]="http://sprunge.us/iQNF" [dd]="http://sprunge.us/Ucaa" [gawk4]="http://sprunge.us/PWjJ" [bash4]="http://sprunge.us/EaaR" [patch]="http://sprunge.us/QXIf" [gencat]="http://sprunge.us/NheQ" [df]="http://sprunge.us/bZAi" [nice]="http://sprunge.us/PTYU" [bash2]="http://sprunge.us/JbPF" [tabs]="http://sprunge.us/XXFZ" [gawk3]="http://sprunge.us/ONWS" [bash3]="http://sprunge.us/fgQG" [ksh]="http://sprunge.us/LXbW" [bash1]="http://sprunge.us/LIiZ" [rmdir]="http://sprunge.us/EbXf" [nohup]="http://sprunge.us/NFWS" [link]="http://sprunge.us/XGHZ" [join]="http://sprunge.us/TbQC" [comm]="http://sprunge.us/cEWJ" [file]="http://sprunge.us/iQUJ" [logname]="http://sprunge.us/NQPa" [sort]="http://sprunge.us/bJhi" [fold]="http://sprunge.us/PHNU" [bash+]="http://sprunge.us/Oegh" [head]="http://sprunge.us/TRDW" [tput]="http://sprunge.us/OKYT" [uudecode]="http://sprunge.us/QSdQ" [tsort]="http://sprunge.us/DLPf" [od]="http://sprunge.us/VAQZ" [du]="http://sprunge.us/VZIQ" [rm]="http://sprunge.us/UUaC" [pax]="http://sprunge.us/YVDR" [newgrp]="http://sprunge.us/aYOP" [ed]="http://sprunge.us/YeBR" [echo]="http://sprunge.us/BbZV" [chmod]="http://sprunge.us/XgFg" ["["]="http://sprunge.us/LTPU" [gzip]="http://sprunge.us/bNHH" [dirname]="http://sprunge.us/VRaO" [date]="http://sprunge.us/gOfM" [cat]="http://sprunge.us/QUGV" [touch]="http://sprunge.us/KdFj" [expr]="http://sprunge.us/LFQR" [diff]="http://sprunge.us/jPcE" [tee]="http://sprunge.us/KcTB" [locale]="http://sprunge.us/cJLB" [mount]="http://sprunge.us/USZj" [split]="http://sprunge.us/IKUR" [sed]="http://sprunge.us/GFEE" [sleep]="http://sprunge.us/TFCb" [mv]="http://sprunge.us/HRFM" [pr]="http://sprunge.us/hANH" [ps]="http://sprunge.us/YhFi" [m4]="http://sprunge.us/jBjY" [tac]="http://sprunge.us/BCFZ" [dash]="http://sprunge.us/ICaB" [uuencode]="http://sprunge.us/SjiQ" [uname]="http://sprunge.us/EZAa" [bc]="http://sprunge.us/LOTE" [mktemp]="http://sprunge.us/faiR" [who]="http://sprunge.us/jRga" [true]="http://sprunge.us/LPCg" [paste]="http://sprunge.us/BHAe" [mkdir]="http://sprunge.us/MbAd" [cp]="http://sprunge.us/MYXA" [ln]="http://sprunge.us/cRIN" [chgrp]="http://sprunge.us/NiAN" [localedef]="http://sprunge.us/RbJH" [test]="http://sprunge.us/XHRj" [cmp]="http://sprunge.us/EjHD" [mksh]="http://sprunge.us/UaXZ" [unlink]="http://sprunge.us/ZUSe" [uncompress]="http://sprunge.us/ZaXK" [strace]="http://sprunge.us/TfcM" [tr]="http://sprunge.us/YHRE" [id]="http://sprunge.us/NgNO" [stty]="http://sprunge.us/MTAb" [cut]="http://sprunge.us/ijQM" [oawk]="http://sprunge.us/Zghf" [cksum]="http://sprunge.us/VgXg" [setsid]="http://sprunge.us/KbaK" [compress]="http://sprunge.us/bSde" [env]="http://sprunge.us/gWUQ" [csplit]="http://sprunge.us/PNCG" [zcat]="http://sprunge.us/COjg" [wc]="http://sprunge.us/ZPeA" [mknod]="http://sprunge.us/XNIJ" [ls]="http://sprunge.us/gHRh" [iconv]="http://sprunge.us/NOab" [fuser]="http://sprunge.us/gLUG" [nawk]="http://sprunge.us/GGCE" [unexpand]="http://sprunge.us/ccXF" [find]="http://sprunge.us/geAX" [strings]="http://sprunge.us/GMWS" [getent]="http://sprunge.us/aWjW" [logger]="http://sprunge.us/CeDd" [mkfifo]="http://sprunge.us/HbdB" [getconf]="http://sprunge.us/jQUJ" [uniq]="http://sprunge.us/jaNV" )'

0 comments on commit 7b30aa2

Please sign in to comment.