From: Brendan Hansen Date: Thu, 31 Aug 2023 22:03:52 +0000 (-0500) Subject: fixed: no longer require `sudo` access X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=f46d2ef1a6ed7a0295414a0b2337ea290e55c528;p=onyx.git fixed: no longer require `sudo` access --- diff --git a/build.sh b/build.sh index 823497b9..59854bab 100755 --- a/build.sh +++ b/build.sh @@ -1,19 +1,23 @@ #!/bin/sh +[ ! $UID = 0 ] \ + && echo "Please run this script as root." \ + && exit 1 + . ./settings.sh echo "Installing on '$(uname -a)'" echo "Installing core libs" -[ -d "$CORE_DIR/core" ] && sudo rm -r "$CORE_DIR/core" -sudo mkdir -p "$CORE_DIR" -sudo cp -r ./core/ "$CORE_DIR" +[ -d "$CORE_DIR/core" ] && rm -r "$CORE_DIR/core" +mkdir -p "$CORE_DIR" +cp -r ./core/ "$CORE_DIR" -sudo mkdir -p "$CORE_DIR/tools" -sudo mkdir -p "$CORE_DIR/tools/pkg_templates" -sudo cp ./scripts/onyx-pkg.onyx "$CORE_DIR/tools" -sudo cp ./scripts/default.json "$CORE_DIR/tools/pkg_templates" +mkdir -p "$CORE_DIR/tools" +mkdir -p "$CORE_DIR/tools/pkg_templates" +cp ./scripts/onyx-pkg.onyx "$CORE_DIR/tools" +cp ./scripts/default.json "$CORE_DIR/tools/pkg_templates" # This is a development feature to allow for quickly reinstalling core libraries # without have to recompile the entire compiler @@ -28,13 +32,13 @@ fi if [ ! -f "$CORE_DIR/lib/lib$RUNTIME_LIBRARY.so" ] || true; then echo "Copying lib$RUNTIME_LIBRARY to $CORE_DIR/lib (first install)" - sudo mkdir -p "$CORE_DIR/lib" - sudo mkdir -p "$CORE_DIR/include" + mkdir -p "$CORE_DIR/lib" + mkdir -p "$CORE_DIR/include" - sudo cp "$WASMER_LIBRARY_DIR/lib$RUNTIME_LIBRARY.so" "$CORE_DIR/lib/lib$RUNTIME_LIBRARY.so" + cp "$WASMER_LIBRARY_DIR/lib$RUNTIME_LIBRARY.so" "$CORE_DIR/lib/lib$RUNTIME_LIBRARY.so" - sudo cp "shared/include/onyx_library.h" "$CORE_DIR/include/onyx_library.h" - sudo cp "$WASMER_INCLUDE_DIR/wasm.h" "$CORE_DIR/include/wasm.h" + cp "shared/include/onyx_library.h" "$CORE_DIR/include/onyx_library.h" + cp "$WASMER_INCLUDE_DIR/wasm.h" "$CORE_DIR/include/wasm.h" fi cd compiler diff --git a/compiler/build.sh b/compiler/build.sh index 7510b749..715a7baa 100755 --- a/compiler/build.sh +++ b/compiler/build.sh @@ -35,7 +35,7 @@ if [ "$USE_DYNCALL" = "1" ]; then FLAGS="$FLAGS -DUSE_DYNCALL" fi -sudo mkdir -p "$BIN_DIR" +mkdir -p "$BIN_DIR" echo "Compiling onyx..." $CC -o "../bin/onyx" \ @@ -46,7 +46,7 @@ $CC -o "../bin/onyx" \ $LIBS echo "Installing onyx executable" -sudo cp "../bin/onyx" "$BIN_DIR/onyx" +cp "../bin/onyx" "$BIN_DIR/onyx" C_FILES="onyxrun wasm_runtime " @@ -58,4 +58,4 @@ $CC -o "../bin/onyx-run" \ $LIBS echo "Installing onyx-run executable" -sudo cp "../bin/onyx-run" "$BIN_DIR/onyx-run" +cp "../bin/onyx-run" "$BIN_DIR/onyx-run" diff --git a/runtime/build.sh b/runtime/build.sh index b0b461ce..fa1ab04c 100755 --- a/runtime/build.sh +++ b/runtime/build.sh @@ -9,4 +9,4 @@ $CC -shared -fpic -w -O2 \ -lpthread echo "Installing onyx_runtime.so" -sudo mv "../bin/onyx_runtime.so" "$CORE_DIR/lib/onyx_runtime.so" +mv "../bin/onyx_runtime.so" "$CORE_DIR/lib/onyx_runtime.so"