From 0daffab4a770340a588a3408f8be4fdd1e171927 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 5 Mar 2023 15:42:31 +0000 Subject: [PATCH] prereq script --- Earthfile | 3 ++- install_linux_prerequisites.sh | 33 +++++++++++++++++++++++++++++++++ scripts/debug.sh | 7 ------- scripts/debug_ssh.sh | 12 ------------ setup_linux.sh | 8 +------- 5 files changed, 36 insertions(+), 27 deletions(-) create mode 100755 install_linux_prerequisites.sh delete mode 100644 scripts/debug.sh delete mode 100755 scripts/debug_ssh.sh diff --git a/Earthfile b/Earthfile index fae4e054..f39414de 100644 --- a/Earthfile +++ b/Earthfile @@ -54,7 +54,8 @@ deps-android: RUN mkdir /Android; mkdir /Android/Sdk RUN curl -o /Android/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip RUN cd /Android; unzip /Android/cmdline-tools.zip - RUN yes | /Android/cmdline-tools/bin/sdkmanager --sdk_root=/Android/Sdk build-tools\;33.0.1 ndk\;25.1.8937393 cmake\;3.22.1 platform-tools platforms\;android-33 + RUN yes | /Android/cmdline-tools/bin/sdkmanager --sdk_root=/Android/Sdk build-tools\;33.0.1 ndk\;25.1.8937393 cmake\;3.22.1 platform-tools platforms\;android-33 cmdline-tools\;latest + RUN rm -rf /Android/cmdline-tools RUN apt-get clean # Just linux build not android diff --git a/install_linux_prerequisites.sh b/install_linux_prerequisites.sh new file mode 100755 index 00000000..202ddf50 --- /dev/null +++ b/install_linux_prerequisites.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -eo pipefail + +if [ $(id -u) -eq 0 ]; then + echo "Don't run this as root" + exit +fi + +# Install APT dependencies +sudo apt update -y +sudo apt install -y openjdk-11-jdk-headless iproute2 curl build-essential cmake libssl-dev openssl file git pkg-config libdbus-1-dev libdbus-glib-1-dev libgirepository1.0-dev libcairo2-dev checkinstall unzip llvm wabt checkinstall + +# Install Rust +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -c clippy --profile default +source "$HOME/.cargo/env" + +# Install Android SDK +mkdir $HOME/Android; mkdir $HOME/Android/Sdk +curl -o $HOME/Android/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip +cd $HOME/Android; unzip $HOME/Android/cmdline-tools.zip +$HOME/Android/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/Android/Sdk build-tools\;33.0.1 ndk\;25.1.8937393 cmake\;3.22.1 platform-tools platforms\;android-33 cmdline-tools\;latest emulator +cd $HOME +rm -rf $HOME/Android/cmdline-tools $HOME/Android/cmdline-tools.zip + +# Add environment variables +cat >> $HOME/.profile < /dev/null -echo Running lldb-server -pushd /tmp > /dev/null -sudo -u veilid lldb-server platform --server --listen 127.0.0.1:6969 --gdbserver-port 6970 -popd > /dev/null \ No newline at end of file diff --git a/scripts/debug_ssh.sh b/scripts/debug_ssh.sh deleted file mode 100755 index e7ea23b0..00000000 --- a/scripts/debug_ssh.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -SSHHOST=$1 -if [[ "$SSHHOST" == "" ]]; then - SSHHOST="root@bootstrap-1.dev.veilid.net" -fi - -echo Copying debug script -scp -q $SCRIPTDIR/debug.sh $SSHHOST:/tmp/debug.sh -echo Connecting to debug server -ssh -t $SSHHOST -L 6969:127.0.0.1:6969 -L 6970:127.0.0.1:6970 'bash /tmp/debug.sh' diff --git a/setup_linux.sh b/setup_linux.sh index 8e13f7a8..1a307c9f 100755 --- a/setup_linux.sh +++ b/setup_linux.sh @@ -22,7 +22,7 @@ else fi # ensure Android Command Line Tools exist -if [ -d "$ANDROID_SDK_ROOT/cmdline-tools" ]; then +if [ -d "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin" ]; then echo '[X] Android command line tools are installed' else echo 'Android command line tools are not installed' @@ -91,12 +91,6 @@ rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-andro # install cargo packages cargo install wasm-bindgen-cli wasm-pack -# Ensure packages are installed -sudo apt-get install libc6-dev-i386 libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 openjdk-11-jdk llvm wabt checkinstall - -# Ensure android sdk packages are installed -$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager build-tools\;33.0.1 ndk\;25.1.8937393 cmake\;3.22.1 platform-tools platforms\;android-33 - # Install capnproto using the same mechanism as our earthly build $SCRIPTDIR/scripts/earthly/install_capnproto.sh # Install protoc using the same mechanism as our earthly build