summaryrefslogtreecommitdiff
path: root/Kernel/build-root-filesystem.sh
diff options
context:
space:
mode:
authorGeorge Pickering <29524044+tedjenkins@users.noreply.github.com>2019-11-02 16:34:54 +0000
committerAndreas Kling <awesomekling@gmail.com>2019-11-03 09:26:22 +0100
commit704f48d7f3a1a88047a64b4e2939878d6d4fafb8 (patch)
tree5fc1e15abb6a5e828217f12aa926b1ca9b35991f /Kernel/build-root-filesystem.sh
parent2cc5f3a93f84ad0004b99fa22d4b130dfb38e6ba (diff)
downloadserenity-704f48d7f3a1a88047a64b4e2939878d6d4fafb8.zip
POSIX compliance: (most) shell scripts converted to generic shell
Ports/.port_include.sh, Toolchain/BuildIt.sh, Toolchain/UseIt.sh have been left largely untouched due to use of Bash-exclusive functions and variables such as $BASH_SOURCE, pushd and popd.
Diffstat (limited to 'Kernel/build-root-filesystem.sh')
-rwxr-xr-xKernel/build-root-filesystem.sh24
1 files changed, 13 insertions, 11 deletions
diff --git a/Kernel/build-root-filesystem.sh b/Kernel/build-root-filesystem.sh
index c05867e1cd..6c42abed54 100755
--- a/Kernel/build-root-filesystem.sh
+++ b/Kernel/build-root-filesystem.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
set -e
@@ -6,20 +6,22 @@ set -e
rm -f ../Userland/qs
die() {
- echo "die: $@"
+ echo "die: $*"
exit 1
}
-if [ $(id -u) != 0 ]; then
+if [ "$(id -u)" != 0 ]; then
die "this script needs to run as root"
fi
-echo -n "creating initial filesystem structure... "
-mkdir -p mnt/{bin,etc,proc,mnt,tmp}
+printf "creating initial filesystem structure... "
+for dir in bin etc proc mnt tmp; do
+ mkdir -p mnt/$dir
+done
chmod 1777 mnt/tmp
echo "done"
-echo -n "setting up device nodes... "
+printf "setting up device nodes... "
mkdir -p mnt/dev
mkdir -p mnt/dev/pts
mknod -m 666 mnt/dev/fb0 b 29 0
@@ -49,13 +51,13 @@ ln -s /proc/self/fd/1 mnt/dev/stdout
ln -s /proc/self/fd/2 mnt/dev/stderr
echo "done"
-echo -n "installing base system... "
+printf "installing base system... "
cp -R ../Base/* mnt/
cp -R ../Root/* mnt/
cp kernel.map mnt/
echo "done"
-echo -n "installing users... "
+printf "installing users... "
mkdir -p mnt/home/anon
mkdir -p mnt/home/nona
cp ../ReadMe.md mnt/home/anon/
@@ -63,12 +65,12 @@ chown -R 100:100 mnt/home/anon
chown -R 200:200 mnt/home/nona
echo "done"
-echo -n "installing userland... "
+printf "installing userland... "
find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;
chmod 4755 mnt/bin/su
echo "done"
-echo -n "installing applications... "
+printf "installing applications... "
cp ../Applications/About/About mnt/bin/About
cp ../Applications/Downloader/Downloader mnt/bin/Downloader
cp ../Applications/FileManager/FileManager mnt/bin/FileManager
@@ -110,7 +112,7 @@ cp ../Servers/TelnetServer/TelnetServer mnt/bin/TelnetServer
cp ../Shell/Shell mnt/bin/Shell
echo "done"
-echo -n "installing shortcuts... "
+printf "installing shortcuts... "
ln -s Downloader mnt/bin/dl
ln -s FileManager mnt/bin/fm
ln -s HelloWorld mnt/bin/hw