Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Include all the example loadables from the devel build
Browse files Browse the repository at this point in the history
  • Loading branch information
geirha committed Sep 21, 2012
1 parent ece99e9 commit 62afb4d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
14 changes: 12 additions & 2 deletions build-bash
@@ -1,16 +1,26 @@
#!/bin/bash
shopt -s extglob

version=$1 bin_name=${2:-bash$version}

mkdir -p build/bin &&
if [[ $version = devel ]]; then
mkdir -p build/loadables &&
cd bash &&
./configure &&
make &&
cp bash "../build/bin/$bin_name"
cp bash "../build/bin/$bin_name" &&
# loadable builtins
cd examples/loadables &&
make &&
for file in !(*.*); do
[[ -f $file && -x $file ]] || continue
cp "${file}" ../../../build/loadables
done

exit
fi

mkdir -p build/bin &&
cd build &&
wget -c -O "bash-$version.tar.gz" "http://ftp.gnu.org/gnu/bash/bash-$version.tar.gz" &&
gzip -cd "bash-$version.tar.gz" | pax -r || exit
Expand Down
41 changes: 39 additions & 2 deletions generate-initramfs
Expand Up @@ -209,7 +209,7 @@ declare -A commands='(
[oawk]="pattern scanning and processing language"
)'

mkdir -p initramfs/{bin,dev,etc,lib,root,usr/share}
mkdir -p initramfs/{bin,dev,etc,lib,root,usr/{share,lib}}

declare -A command_paths='()' lib_paths='()'

Expand Down Expand Up @@ -240,6 +240,8 @@ for lib in "${!lib_paths[@]}"; do
cp "${lib_paths[$lib]}" "initramfs/lib/$lib"
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
Expand Down Expand Up @@ -297,6 +299,40 @@ root:x:0:0:root:/root:/bin/bash
EOF

# /root/*
cat > initramfs/root/.load << 'EOF'
# Enables all loadable
enable -f basename basename
enable -f cut cut
enable -f dirname dirname
enable -f finfo finfo
enable -f getconf getconf
enable -f head head
enable -f id id
enable -f ln ln
enable -f logname logname
enable -f mkdir mkdir
enable -f mypid enable_mypid
enable -f pathchk pathchk
enable -f print print
enable -f printenv printenv
enable -f push push
enable -f pushd dirs
enable -f pushd popd
enable -f pushd pushd
enable -f realpath realpath
enable -f rmdir rmdir
enable -f sleep sleep
enable -f strftime strftime
enable -f sync sync
enable -f tee tee
enable -f truefalse false
enable -f truefalse true
enable -f tty tty
enable -f uname uname
enable -f unlink unlink
enable -f whoami whoami
EOF

cat > initramfs/root/.profile << 'EOF'
read RANDOM
read date
Expand Down Expand Up @@ -382,4 +418,5 @@ for awk in nawk mawk gawk oawk bwk; do
[[ -e initramfs/bin/$awk ]] || continue;
ln -sf "$awk" initramfs/bin/awk
break
done
done &&
touch initramfs

0 comments on commit 62afb4d

Please sign in to comment.