fixed: no longer require `sudo` access
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 31 Aug 2023 22:03:52 +0000 (17:03 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 31 Aug 2023 22:03:52 +0000 (17:03 -0500)
build.sh
compiler/build.sh
runtime/build.sh

index 823497b932b3f5bf82dbfe0f968e9f3d29535ba6..59854bab9045b32096a23ba91344293bbafae13e 100755 (executable)
--- 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
index 7510b749a7ac9635e9264c32b630fbbb1d40f2fb..715a7baabf9b1fd2bd6207e4b88475067fde2f3c 100755 (executable)
@@ -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"
index b0b461ceecbc45b9f6264f721753f5342c64e40a..fa1ab04c2740ed0dcda3f6c94e00bdccfd884ddd 100755 (executable)
@@ -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"