mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2024-11-15 03:35:59 +00:00
Attempt fix setup script on Linux
Also update CC BY-SA notice of attribution
This commit is contained in:
parent
e0b2e5ee92
commit
9ef756838b
@ -1,5 +1,4 @@
|
|||||||
base-devel
|
base-devel
|
||||||
code
|
|
||||||
git
|
git
|
||||||
nvm
|
wget
|
||||||
python3
|
python3
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#* linux-update.sh: Install and update dependencies of Mind_Reader, on linux.
|
#* linux-update.sh: Install and update dependencies of Mind_Reader, on linux.
|
||||||
#* Heads-up, this expects to be run from Mind_Reader/setup-development/linux.
|
#* Heads-up, this expects to be run from Mind_Reader/setup-development/linux.
|
||||||
|
|
||||||
|
|
||||||
# If run with bash -vx, print useful information instead of just a + sign
|
# If run with bash -vx, print useful information instead of just a + sign
|
||||||
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
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)
|
# If run as root, it could be because sudo isn't installed (some people disagree with sudo, especially on Arch)
|
||||||
@ -26,6 +25,31 @@ function dryrun {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get whether the user is running in Windows Subsystem for Linux
|
||||||
|
function getwsl {
|
||||||
|
grep "[Mm]icrosoft" /proc/version > /dev/null
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the user's default login shell
|
||||||
|
function getsh {
|
||||||
|
#* This code was created by user [Todd A. Jacobs](https://stackoverflow.com/users/1301972/todd-a-jacobs) on [StackOverflow](https://stackoverflow.com/a/11059152) and is used in accordance with Creative Commons CC BY-SA 3.0
|
||||||
|
getent passwd $LOGNAME | cut -d: -f7
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install NVM (this is gross, but the recommended way to install nvm)
|
||||||
|
function installnvm {
|
||||||
|
# nvm's install script tries to be smart, so we have to work around its supposed cleverness
|
||||||
|
usershell=`getsh`
|
||||||
|
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | dryrun "$usershell"
|
||||||
|
# Reload profile
|
||||||
|
case $usershell in
|
||||||
|
*/bash) dryrun . ~/.bashrc ~/.bashprofile;;
|
||||||
|
*/zsh) dryrun . ~/.zshrc;;
|
||||||
|
*) "Your shell, $usershell, is currently unsupported by nvm. It's up to you to set up your development environment."; exit;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Set these variables if you need to install for a different architecture
|
# Set these variables if you need to install for a different architecture
|
||||||
# Valid architectures are "x64", "arm64", "armhf"
|
# Valid architectures are "x64", "arm64", "armhf"
|
||||||
arch=""
|
arch=""
|
||||||
@ -39,29 +63,31 @@ esac
|
|||||||
|
|
||||||
if which pacman; then
|
if which pacman; then
|
||||||
# Install dependencies with pacman
|
# Install dependencies with pacman
|
||||||
|
printf "Installing dependencies with pacman...\n"
|
||||||
cat ./package-managers/pacman.dependencies | dryrun $ELEVATE pacman -S -
|
cat ./package-managers/pacman.dependencies | dryrun $ELEVATE pacman -S -
|
||||||
|
# If not in Windows Subsystem for Linux, install vscode
|
||||||
|
[[ !(getwsl) ]] && dryrun $ELEVATE pacman -S code
|
||||||
|
# Install Node Version Manager
|
||||||
|
installnvm
|
||||||
|
|
||||||
elif which apt-get; then
|
elif which apt-get; then
|
||||||
# Install dependencies using apt-get
|
# Install dependencies using apt-get
|
||||||
|
printf "Installing dependencies with apt...\n"
|
||||||
dryrun xargs -a ./package-managers/apt.dependencies $ELEVATE apt-get install -y
|
dryrun xargs -a ./package-managers/apt.dependencies $ELEVATE apt-get install -y
|
||||||
|
|
||||||
# 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.
|
|
||||||
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | dryrun bash
|
|
||||||
dryrun export NVM_DIR="$HOME/.nvm"
|
|
||||||
dryrun [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
||||||
dryrun [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
||||||
|
|
||||||
# Check if vscode exists, if not, install it.
|
# 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.
|
# Microsoft doesn't put it in any Ubuntu repos, you have to get it straight from them.
|
||||||
# This does have the side effect, however, of installing the official repository
|
# This does have the side effect, however, of installing the official repository
|
||||||
if !(which code); then
|
# Don't attempt to install vscode if running in WSL; it can cause problems.
|
||||||
|
if !(which code) && !(getwsl); then
|
||||||
#* Install VSCode
|
#* Install VSCode
|
||||||
vscodepackagename="code_amd64.deb"
|
vscodepackagename="code_amd64.deb"
|
||||||
dryrun wget "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-$arch" -O ./code.deb
|
dryrun wget "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-$arch" -O ./code.deb
|
||||||
dryrun $ELEVATE apt install ./code.deb
|
dryrun $ELEVATE apt install ./code.deb
|
||||||
dryrun rm ./code.deb
|
dryrun rm ./code.deb
|
||||||
fi
|
fi
|
||||||
|
# Install Node Version Manager (nvm)
|
||||||
|
installnvm
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cdir=$(pwd)
|
cdir=$(pwd)
|
||||||
@ -76,7 +102,7 @@ electronversion=""
|
|||||||
#* By the time you're working on this project, things are likely going to differ!
|
#* 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
|
#* Each version of VSCode has a corresponding Electron version and Node version
|
||||||
#* These are used when
|
#* These are used when configuring nvm
|
||||||
1.66.*) electronversion="17.2.0"; nodeversion="16.14.2";;
|
1.66.*) electronversion="17.2.0"; nodeversion="16.14.2";;
|
||||||
*) nodeversion="--lts";;
|
*) nodeversion="--lts";;
|
||||||
esac
|
esac
|
||||||
@ -95,7 +121,7 @@ dryrun npm install
|
|||||||
dryrun npm audit fix
|
dryrun npm audit fix
|
||||||
|
|
||||||
# Use electron-rebuild to rebuild electron
|
# Use electron-rebuild to rebuild electron
|
||||||
if [ "$electronversion" != "" ]; then
|
if [[ "$electronversion" != "" ]]; then
|
||||||
dryrun electron-rebuild --version $electronversion
|
dryrun electron-rebuild --version $electronversion
|
||||||
else
|
else
|
||||||
printf "%s\n%s\n%s\n%s\n" \
|
printf "%s\n%s\n%s\n%s\n" \
|
||||||
|
@ -93,7 +93,7 @@ function Invoke-DryRun {
|
|||||||
# Reset-Path: Reload the Path environment variable
|
# Reset-Path: Reload the Path environment variable
|
||||||
function Reset-Path {
|
function Reset-Path {
|
||||||
Write-Output "Reloading Path..."
|
Write-Output "Reloading Path..."
|
||||||
#* Courtesy of user [mpen](https://stackoverflow.com/users/65387/mpen) on [StackOverflow](https://stackoverflow.com/a/31845512)
|
#* This code was created by user [mpen](https://stackoverflow.com/users/65387/mpen) on [StackOverflow](https://stackoverflow.com/a/31845512) and is used in accordance with Creative Commons CC BY-SA 3.0
|
||||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ function Invoke-Dryrun {
|
|||||||
# Reset-Path: Reload the Path environment variable
|
# Reset-Path: Reload the Path environment variable
|
||||||
function Reset-Path {
|
function Reset-Path {
|
||||||
Write-Output "Reloading Path..."
|
Write-Output "Reloading Path..."
|
||||||
#* Courtesy of user [mpen](https://stackoverflow.com/users/65387/mpen) on [StackOverflow](https://stackoverflow.com/a/31845512)
|
#* This code was created by user [mpen](https://stackoverflow.com/users/65387/mpen) on [StackOverflow](https://stackoverflow.com/a/31845512) and is used in accordance with Creative Commons CC BY-SA 3.0
|
||||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"PackageIdentifier": "Microsoft.VisualStudioCode"
|
"PackageIdentifier": "Microsoft.VisualStudioCode"
|
||||||
},
|
|
||||||
{
|
|
||||||
"PackageIdentifier": "NVAccess.NVDA"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"SourceDetails": {
|
"SourceDetails": {
|
||||||
|
@ -17,7 +17,7 @@ export enum Symbol {
|
|||||||
FINALLY = "finally",
|
FINALLY = "finally",
|
||||||
WITH = "with",
|
WITH = "with",
|
||||||
STATEMENT = "statement", // Indent token, contains non-empty code lines
|
STATEMENT = "statement", // Indent token, contains non-empty code lines
|
||||||
COMMENT = "comment",
|
COMMENT = "Comment",
|
||||||
EMPTY = "EMPTY", // empty line, used only to associate with the previous line
|
EMPTY = "EMPTY", // empty line, used only to associate with the previous line
|
||||||
INVALID = "INVALID",
|
INVALID = "INVALID",
|
||||||
EOF = "EOF"
|
EOF = "EOF"
|
||||||
|
Loading…
Reference in New Issue
Block a user