From 41b3c37ed3556fb292fb54c5bea06abd4e596639 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 28 Apr 2022 18:10:31 -0500 Subject: [PATCH] Linux: Apt: Fix installation issues. --- setup-development/linux/install-linux.sh | 13 +++++++------ setup-development/linux/upgrade-linux.sh | 16 ++++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/setup-development/linux/install-linux.sh b/setup-development/linux/install-linux.sh index 38c465e..572727e 100644 --- a/setup-development/linux/install-linux.sh +++ b/setup-development/linux/install-linux.sh @@ -7,12 +7,12 @@ export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' ELEVATE='';if (( $UID !=0 )); then ELEVATE='sudo';fi help () { - echo "Usage: $0 [-g path/to/git/directory]" + echo "Usage: $0 [-d] [-g path/to/git/directory]" exit 0 } -gitdir="~/git" +gitdir=~/git # Get option flags: dry=false @@ -33,7 +33,7 @@ function dryrun { fi } -setupdir="Mind_Reader/setup-development" +setupdir="Mind_Reader/setup-development/linux" repouri="https://github.com/We-Dont-Byte/Mind_Reader.git" # Install git @@ -50,12 +50,13 @@ fi #? TODO: other package managers? echo Cloning repository into "$gitdir" dryrun mkdir "$gitdir" -cd $gitdir && git clone "$repouri" +cd $gitdir && dryrun git clone "$repouri" # TODO: remove this when merging! cd Mind_Reader - dryrun git checkout origin/johnBreaux + dryrun git checkout johnBreaux # TODO: remove this when merging! cd "$gitdir/$setupdir" -bash ./linux-update.sh \ No newline at end of file +pwd +bash ./upgrade-linux.sh $@ diff --git a/setup-development/linux/upgrade-linux.sh b/setup-development/linux/upgrade-linux.sh index aa59c1d..32093ea 100644 --- a/setup-development/linux/upgrade-linux.sh +++ b/setup-development/linux/upgrade-linux.sh @@ -7,7 +7,7 @@ # If run with bash -vx, print useful information instead of just a + sign export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' # If run as root, it could be because sudo isn't installed (some people disagree with sudo, especially on Arch) -ELEVATE='';if (( $UID !=0 )); then;ELEVATE='sudo';fi +ELEVATE='';if (( $UID !=0 )); then ELEVATE='sudo';fi # Get option flags: dry=false @@ -23,12 +23,13 @@ function dryrun { else echo "> $*" $@ + fi } # Set these variables if you need to install for a different architecture # Valid architectures are "x64", "arm64", "armhf" arch="" -case (uname -i) in +case `uname -i` in "x86_64") arch="x64";; "armv[6-8]*") arch="armhf";; "aarch64") arch="arm64";; @@ -46,6 +47,9 @@ elif which apt-get; then # Install Node Version Manager (nvm) # TODO: Find a better way to install nvm on Ubuntu, the official NodeJS for <20.04 is so out of date it's unsupported. dryrun curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Check if vscode exists, if not, install it. # Microsoft doesn't put it in any Ubuntu repos, you have to get it straight from them. @@ -69,7 +73,7 @@ electronversion="" #* Note: #* When adding support for new VSCode versions, update this case #* By the time you're working on this project, things are likely going to differ! -case (code --version) in +case `code --version` in #* Each version of VSCode has a corresponding Electron version and Node version #* These are used when 1.66.*) electronversion="17.2.0"; nodeversion="16.13.0";; @@ -87,14 +91,14 @@ dryrun npm install electron-rebuild yo generator-code dryrun npm install # Use electron-rebuild to rebuild electron -if (( electronversion !="" )); then +if [ "$electronversion" != "" ]; then dryrun electron-rebuild --version $electronversion else - printf "%s/n%s/n%s/n%s/n" \ + printf "%s\n%s\n%s\n%s\n" \ "Open Visual Studio Code, select the 'Help' tab in the toolbar, and go to 'About'." \ "Find the line that says 'Electron: [electron version]'" \ "Run the command below, filling in the Electron version with the one from that menu:" \ "electron-rebuild --version [electron version]" fi -cd $cdir \ No newline at end of file +cd $cdir