diff options
author | Itamar <itamar8910@gmail.com> | 2021-08-22 10:11:17 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-22 10:28:13 +0200 |
commit | 6f4324e64eb57013f74a82b9cba6a1f915d61b9e (patch) | |
tree | 07109cedf23ca78c1c43a0e47f5f7520b09b2946 | |
parent | f6f429bfbc4c54377a92293c6d6b521b0ca8f532 (diff) | |
download | serenity-6f4324e64eb57013f74a82b9cba6a1f915d61b9e.zip |
Meta: Add 'copy-src' command to serenity.sh
This command copies the project's source tree to
/home/anon/Source/serenity in the built disk image.
This will be useful for working on serenity inside serenity :^)
-rwxr-xr-x | Meta/build-root-filesystem.sh | 9 | ||||
-rwxr-xr-x | Meta/serenity.sh | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh index 1660e2f47d..9d9bc52faa 100755 --- a/Meta/build-root-filesystem.sh +++ b/Meta/build-root-filesystem.sh @@ -155,6 +155,15 @@ cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibCpp/Tests/parser mnt/home/ano cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibCpp/Tests/preprocessor mnt/home/anon/cpp-tests/preprocessor cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibWasm/Tests mnt/home/anon/wasm-tests cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibJS/Tests/test-common.js mnt/home/anon/wasm-tests + +if [ -n "$SERENITY_COPY_SOURCE" ] ; then + printf "\ncopying Serenity's source... " + rm -fr mnt/home/anon/Source/serenity + mkdir -p mnt/home/anon/Source/serenity + git clone --depth=1 file://"$SERENITY_SOURCE_DIR" mnt/home/anon/Source/serenity + rm -fr mnt/home/anon/Source/serenity/.git +fi + chmod 700 mnt/root chmod 700 mnt/home/anon chmod 700 mnt/home/nona diff --git a/Meta/serenity.sh b/Meta/serenity.sh index be4b7d6739..09525406e6 100755 --- a/Meta/serenity.sh +++ b/Meta/serenity.sh @@ -40,6 +40,9 @@ Usage: $NAME COMMAND [TARGET] [ARGS...] attempt to find the BINARY_FILE in the appropriate build directory rebuild-toolchain: Deletes and re-builds the TARGET's toolchain rebuild-world: Deletes and re-builds the toolchain and build environment for TARGET. + copy-src: Same as image, but also copies the project's source tree to ~/Source/serenity + in the built disk image. + Examples: $NAME run i686 smp=on @@ -239,7 +242,7 @@ run_gdb() { fi } -if [[ "$CMD" =~ ^(build|install|image|run|gdb|test|rebuild|recreate|kaddr2line|addr2line|setup-and-run)$ ]]; then +if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kaddr2line|addr2line|setup-and-run)$ ]]; then cmd_with_target [[ "$CMD" != "recreate" && "$CMD" != "rebuild" ]] || delete_target [ "$TARGET" = "lagom" ] || ensure_toolchain @@ -259,6 +262,13 @@ if [[ "$CMD" =~ ^(build|install|image|run|gdb|test|rebuild|recreate|kaddr2line|a build_target install build_target image ;; + copy-src) + lagom_unsupported + build_target + build_target install + export SERENITY_COPY_SOURCE=1 + build_target image + ;; run) if [ "$TARGET" = "lagom" ]; then build_target "${CMD_ARGS[0]}" |