summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-04 02:50:10 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-04 02:50:10 +0200
commit7aba0058ae815afb26b4d393c4772dea6a6258b5 (patch)
tree2d327fb7d172e6d0884b32a573ff8e7152cca449 /Kernel
parent8b249bd09bc63ad3a9aa99cc268299f0239b2f7d (diff)
downloadserenity-7aba0058ae815afb26b4d393c4772dea6a6258b5.zip
sync.sh: Don't regenerate _fs_contents from /dev/zero every time.
This makes sync.sh run a lot faster, especially on slower machines. Patch contributed by "pd"
Diffstat (limited to 'Kernel')
-rwxr-xr-xKernel/sync.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/Kernel/sync.sh b/Kernel/sync.sh
index 925d6706c4..3e4074e3de 100755
--- a/Kernel/sync.sh
+++ b/Kernel/sync.sh
@@ -2,10 +2,15 @@ if [ $(id -u) != 0 ]; then
echo "This needs to be run as root"
exit
fi
+
rm -vf _fs_contents.lock
-rm -vf _fs_contents
-dd if=/dev/zero of=_fs_contents bs=1M count=512
-mke2fs -I 128 _fs_contents
+
+# If target filesystem image doesn't exist, create it.
+if [ ! -f _fs_contents ]; then
+ dd if=/dev/zero of=_fs_contents bs=1M count=512
+fi
+
+mke2fs -F -I 128 _fs_contents
chown 1000:1000 _fs_contents
mkdir -vp mnt
mount -o loop _fs_contents mnt/
@@ -64,5 +69,10 @@ ln -s Minesweeper mnt/bin/ms
cp -v ../Games/Snake/Snake mnt/bin/Snake
ln -s Snake mnt/bin/sn
cp -v kernel.map mnt/
-sh sync-local.sh
+
+# Run local sync script, if it exists
+if [ -f sync-local.sh ]; then
+ sh sync-local.sh
+fi
+
umount mnt || ( sleep 0.5 && sync && umount mnt )