From d3017a7901de278755ddfe5421e434d3c25025c2 Mon Sep 17 00:00:00 2001 From: salkin-mada Date: Fri, 24 Jun 2022 17:28:24 +0200 Subject: [PATCH] feat: arch linux install script --- README.md | 19 +++++++++ install/archlinux+arm.sh | 89 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 install/archlinux+arm.sh diff --git a/README.md b/README.md index 8917582..5c3e0bf 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,22 @@ Install nn~ for PureData using ```bash curl -s https://raw.githubusercontent.com/acids-ircam/nn_tilde/master/install/raspberrypi.sh | bash ``` + +### Arch Linux + Arch Linux Arm 64 + +Install nn~ for PureData with defaults + +```bash +curl -s https://raw.githubusercontent.com/acids-ircam/nn_tilde/master/install/archlinux+arm.sh | bash +``` + +#### Change install location + +* global +```bash +wget https://raw.githubusercontent.com/acids-ircam/nn_tilde/master/install/archlinux+arm.sh; chmod +x ./archlinux+arm.sh; ./archlinux+arm.sh -i g; rm ./archlinux+arm.sh +``` +* application specific +```bash +wget https://raw.githubusercontent.com/acids-ircam/nn_tilde/master/install/archlinux+arm.sh; chmod +x ./archlinux+arm.sh; ./archlinux+arm.sh -i a; rm ./archlinux+arm.sh +``` diff --git a/install/archlinux+arm.sh b/install/archlinux+arm.sh new file mode 100644 index 0000000..d4e2847 --- /dev/null +++ b/install/archlinux+arm.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# INSTALL SCRIPT FOR ARCH-LINUX / ARCH-LINUX-ARM64 + +version=0.0.1 +usage="-i {u|a|g} -hv" + +display_help() { + echo + echo "░ nn~ installer ░" + echo + echo " -i, install location" + echo " u user specific (default)" + echo " a app specific" + echo " g global" + echo " -h, show this help" + echo " -v, script version" + echo + exit 0 +} + +# possible install locations +user_specific=~/.local/lib/pd/extra +application_specific=/usr/lib/pd/extra +global=/usr/local/lib/pd-externals + +INSTALL_LOCATION=$user_specific +LIBTORCH=usr/lib/python3.10/site-packages/torch + +while getopts i:hv option + do + case "${option}" in + i ) + case ${OPTARG} in + a) + INSTALL_LOCATION=$application_specific;; + u) + INSTALL_LOCATION=$user_specific;; + g) + INSTALL_LOCATION=$global;; + *) + INSTALL_LOCATION=$user_specific;; + esac + ;; + h | -help) + display_help + ;; + v | -version) + echo "nn~ installer v$version" + exit 0 + ;; + *) + echo $usage + exit 0 + ;; + esac +done + +echo "checking dependencies..." +dependencies=("pd" "git" "cmake" "ninja" "python-pytorch") +for str in ${dependencies[@]}; do + pacman -Qi $str + if [[ $? -eq 1 ]]; then + echo "dependency missing" + exit 1 + fi +done + +echo "cloning nn~ into /tmp..." +cd /tmp; git clone https://github.com/acids-ircam/nn_tilde.git; cd nn_tilde + +echo "configuring build..." +mkdir build; cd build +cmake ../src/ -DCMAKE_PREFIX_PATH=$LIBTORCH -DCMAKE_BUILD_TYPE=Release -G Ninja +echo "compiling nn~..." +ninja; + +echo "installing nn~ in $INSTALL_LOCATION..." + +if [[ $INSTALL_LOCATION != $user_specific ]]; then + echo "sudo is needed... changing mode" + sudo mkdir -p $INSTALL_LOCATION + sudo cp frontend/puredata/nn_tilde/nn\~.pd_linux $INSTALL_LOCATION +else + mkdir -p $INSTALL_LOCATION + cp frontend/puredata/nn_tilde/nn\~.pd_linux $INSTALL_LOCATION +fi + +echo "have fun!"