summaryrefslogtreecommitdiff
path: root/Toolchain
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-04-24 20:24:22 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2023-04-25 01:53:42 -0600
commitf5cb46e316cb2bfddd3bdd6d44536830286c9858 (patch)
tree74168d17fefd856ac042882337791386885b8814 /Toolchain
parent9ef3704ce8a8523c18c0e8366c1c144fefb6073b (diff)
downloadserenity-f5cb46e316cb2bfddd3bdd6d44536830286c9858.zip
Toolchain: Exit Build*.sh scripts if executed as root
Diffstat (limited to 'Toolchain')
-rwxr-xr-xToolchain/BuildCMake.sh5
-rwxr-xr-xToolchain/BuildClang.sh5
-rwxr-xr-xToolchain/BuildFuseExt2.sh6
-rwxr-xr-xToolchain/BuildGDB.sh9
-rwxr-xr-xToolchain/BuildIt.sh6
-rwxr-xr-xToolchain/BuildMold.sh5
-rwxr-xr-xToolchain/BuildPython.sh5
-rwxr-xr-xToolchain/BuildQemu.sh5
-rwxr-xr-xToolchain/BuildRuby.sh5
9 files changed, 48 insertions, 3 deletions
diff --git a/Toolchain/BuildCMake.sh b/Toolchain/BuildCMake.sh
index 2242d3a738..ba832b05a2 100755
--- a/Toolchain/BuildCMake.sh
+++ b/Toolchain/BuildCMake.sh
@@ -5,6 +5,11 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildCMake.sh as root, parts of your Toolchain directory will become root-owned"
+
PREFIX_DIR="$DIR/Local/cmake"
BUILD_DIR="$DIR/Build/cmake"
TARBALLS_DIR="$DIR/Tarballs"
diff --git a/Toolchain/BuildClang.sh b/Toolchain/BuildClang.sh
index 985278f9bf..ce0c247e9a 100755
--- a/Toolchain/BuildClang.sh
+++ b/Toolchain/BuildClang.sh
@@ -5,6 +5,11 @@ set -eo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildClang.sh as root, parts of your Toolchain directory will become root-owned"
+
echo "$DIR"
PREFIX="$DIR/Local/clang/"
diff --git a/Toolchain/BuildFuseExt2.sh b/Toolchain/BuildFuseExt2.sh
index 0247f68f7f..3af66ae435 100755
--- a/Toolchain/BuildFuseExt2.sh
+++ b/Toolchain/BuildFuseExt2.sh
@@ -3,6 +3,12 @@ set -e
# This file will need to be run in bash.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildFuseExt2.sh as root, parts of your Toolchain directory will become root-owned"
+
export PATH="/usr/local/opt/m4/bin:$PATH"
die() {
diff --git a/Toolchain/BuildGDB.sh b/Toolchain/BuildGDB.sh
index 75d16d9fd2..fba89b0aa7 100755
--- a/Toolchain/BuildGDB.sh
+++ b/Toolchain/BuildGDB.sh
@@ -1,14 +1,19 @@
#!/usr/bin/env bash
set -e
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildGDB.sh as root, parts of your Toolchain directory will become root-owned"
+
GDB_VERSION="13.1"
GDB_MD5SUM="4aaad768ff2585464173c091947287ec"
GDB_NAME="gdb-$GDB_VERSION"
GDB_PKG="${GDB_NAME}.tar.xz"
GDB_BASE_URL="https://ftp.gnu.org/gnu/gdb"
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
ARCH=${1:-"x86_64"}
TARGET="$ARCH-pc-serenity"
PREFIX="$DIR/Local/$ARCH-gdb"
diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh
index 69c2c5af2d..8147127714 100755
--- a/Toolchain/BuildIt.sh
+++ b/Toolchain/BuildIt.sh
@@ -2,11 +2,15 @@
set -eo pipefail
# This file will need to be run in bash, for now.
-
# === CONFIGURATION AND SETUP ===
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildIt.sh as root, your Build directory will become root-owned"
+
echo "$DIR"
ARCH=${ARCH:-"x86_64"}
diff --git a/Toolchain/BuildMold.sh b/Toolchain/BuildMold.sh
index 1b1bb51fac..2ca4a144cc 100755
--- a/Toolchain/BuildMold.sh
+++ b/Toolchain/BuildMold.sh
@@ -6,6 +6,11 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildMold.sh as root, parts of your Toolchain directory will become root-owned"
+
NPROC="nproc"
SYSTEM_NAME="$(uname -s)"
diff --git a/Toolchain/BuildPython.sh b/Toolchain/BuildPython.sh
index a988d5ecda..8166a32835 100755
--- a/Toolchain/BuildPython.sh
+++ b/Toolchain/BuildPython.sh
@@ -5,6 +5,11 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildPython.sh as root, parts of your Toolchain directory will become root-owned"
+
PREFIX_DIR="$DIR/Local/python"
BUILD_DIR="$DIR/Build/python"
TARBALLS_DIR="$DIR/Tarballs"
diff --git a/Toolchain/BuildQemu.sh b/Toolchain/BuildQemu.sh
index 03ff3733ff..f7a87de1ab 100755
--- a/Toolchain/BuildQemu.sh
+++ b/Toolchain/BuildQemu.sh
@@ -5,6 +5,11 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildQemu.sh as root, parts of your Toolchain directory will become root-owned"
+
echo "$DIR"
PREFIX="$DIR/Local/qemu"
diff --git a/Toolchain/BuildRuby.sh b/Toolchain/BuildRuby.sh
index ec970227e2..2d2b94765f 100755
--- a/Toolchain/BuildRuby.sh
+++ b/Toolchain/BuildRuby.sh
@@ -5,6 +5,11 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# shellcheck source=/dev/null
+. "${DIR}/../Meta/shell_include.sh"
+
+exit_if_running_as_root "Do not run BuildRuby.sh as root, parts of your Toolchain directory will become root-owned"
+
PREFIX_DIR="$DIR/Local/ruby"
BUILD_DIR="$DIR/Build/ruby"
TARBALLS_DIR="$DIR/Tarballs"