From 1ec9959f8e2e9a67e88cae76d58b4e45ff663916 Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Tue, 3 Sep 2024 00:22:20 -0700 Subject: [PATCH 1/9] Enable `system_setup.sh` to build a package install list --- Linux/system_setup.sh | 64 +++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index 22de3c9..09423db 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -1,26 +1,60 @@ #!/bin/bash -# https://stackoverflow.com/a/36273740/3339274 -set -x - +# ------------------------------------------------------------------------------ +# Flags +# ------------------------------------------------------------------------------ # Clone git repo or just fetch relevant files clone_repo=true +# Set which package categories to install +install_apt_utilities=true +install_apt_programming=true +install_apt_rpi=true +install_apt_install_deps=true +# ------------------------------------------------------------------------------ +# Settings +# ------------------------------------------------------------------------------ +# TODO: onboard desktop tools (Firefox, kdenlive, obs, spotify, discord, +# blender, resolve?, keepassxc, steam, notion, filezilla?, GIMP, GitHub Desktop, +# Google Drive?, GPX viewer, Inkscape, KiCad, Legion toolkit?, Logitech client?, +# Libreoffice/openoffice, vlc, Nvidia/AMD/Intel driver, OpenRocket, OpenVPN?, +# Prusaslicer, Pulseview, qBittorrent, RPi imager, VNC, STM32Cube?, Teamviewer, +# TI Connect?, etc.) +apt_utilities="bmon ffmpeg fio gnome-system-monitor gparted htop iotop iperf3 \ + neofetch qdirstat rsync screen smartmontools tmux \ + unattended-upgrades vim x11-apps xcowsay zoxide" +# TODO: onboard FPGA toolchains (Vivado, @sifferman/tangnano_example) +# TODO: onboard Rust toolchains? +apt_programming="ant cmake code git make openjdk-17-jre-headless openocd \ + stlink-tools" +apt_rpi="proot qemu-user-static qemu-utils" +# Required by: Bazel, Global Python Packages, +apt_install_deps="golang pipx python3 python3-pip" + +pip_packages=("black" "pyserial" "youtube_dl") +# ------------------------------------------------------------------------------ + +apt_packages="" # Filled in later +# https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions +[[ $install_apt_utilities = true ]] && apt_packages="${apt_packages} ${apt_utilities}" +[[ $install_apt_programming = true ]] && apt_packages="${apt_packages} ${apt_programming}" +[[ $install_apt_rpi = true ]] && apt_packages="${apt_packages} ${apt_rpi}" +[[ $install_apt_install_deps = true ]] && apt_packages="${apt_packages} ${apt_install_deps}" + +# https://stackoverflow.com/a/36273740/3339274 +set -x # Install most-used packages and update all others sudo apt update sudo apt full-upgrade -y -sudo apt install -y \ - ant bmon cmake code ffmpeg fio git gnome-system-monitor golang htop iotop \ - iperf3 make neofetch openjdk-17-jre-headless openocd pipx proot python3 \ - python3-pip qdirstat qdirstat qemu-user-static qemu-utils rsync screen \ - smartmontools stlink-tools tmux unattended-upgrades vim x11-apps xcowsay zoxide +sudo apt install -y $apt_packages # Patch for Zoxide installation (not yet in apt sources) # https://github.com/ajeetdsouza/zoxide curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh -# :rolling_eyes: https://stackoverflow.com/a/75722775/3339274 -pipx install black -pipx install pyserial -pipx install youtube_dl +# https://stackoverflow.com/a/8880625/3339274 +for i in "${pip_packages[@]}"; do + # :rolling_eyes: https://stackoverflow.com/a/75722775/3339274 + pipx install "$i" +done # ------------------------------------------------------------------------------ # Platform-specific installations @@ -36,12 +70,6 @@ if uname -m | grep "x86_64" > /dev/null; then sudo apt update sudo apt install bazel -y - # Install vscode - # DEPRECATED: apt has VSCode as "code" package - # wget "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" -O vscode.deb - # sudo dpkg -i vscode.deb - # rm vscode.deb - # If WSL2, then do the legwork to enable usbipd # https://github.com/dorssel/usbipd-win/wiki/WSL-support echo "Installing WSL2 usbipd tools..." From 832e384710edd5b8f648652acbcd50f562dab742 Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Tue, 3 Sep 2024 23:57:38 -0700 Subject: [PATCH 2/9] Add desktop and more programming packages --- Linux/system_setup.sh | 127 +++++++++++++++++++++++++++++++++++------- 1 file changed, 106 insertions(+), 21 deletions(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index 09423db..5ed4434 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -1,52 +1,93 @@ #!/bin/bash # ------------------------------------------------------------------------------ -# Flags +# Flags and Settings # ------------------------------------------------------------------------------ # Clone git repo or just fetch relevant files clone_repo=true # Set which package categories to install -install_apt_utilities=true -install_apt_programming=true -install_apt_rpi=true -install_apt_install_deps=true +install_apt_desktop=false # Packages for Desktop Linux +install_apt_utilities=true # CLI utilities +install_apt_programming=true # Programming tools +install_fpga=true # FPGA programming tools +install_apt_rpi=true # Raspberry Pi config tools +install_apt_install_deps=true # Install dependencies for other packages + # should really never be turned off +# Thread count for Make builds +# Consider only using 1/2 threads on Raspberry Pi to prevent >1G RAM usage from +# hitting the swapfile and TANKING build performance +build_threads=$(nproc) # ------------------------------------------------------------------------------ -# Settings +# Package Lists # ------------------------------------------------------------------------------ -# TODO: onboard desktop tools (Firefox, kdenlive, obs, spotify, discord, -# blender, resolve?, keepassxc, steam, notion, filezilla?, GIMP, GitHub Desktop, -# Google Drive?, GPX viewer, Inkscape, KiCad, Legion toolkit?, Logitech client?, -# Libreoffice/openoffice, vlc, Nvidia/AMD/Intel driver, OpenRocket, OpenVPN?, -# Prusaslicer, Pulseview, qBittorrent, RPi imager, VNC, STM32Cube?, Teamviewer, -# TI Connect?, etc.) -apt_utilities="bmon ffmpeg fio gnome-system-monitor gparted htop iotop iperf3 \ - neofetch qdirstat rsync screen smartmontools tmux \ +# TODO: add desktop tools (Resolve, Legion toolkit, Nvidia/AMD/Intel driver, +# OpenRocket, RealVNC Viewer, Teamviewer, TI Connect CE) +# Fusion 360? https://github.com/cryinkfly/Autodesk-Fusion-360-for-Linux +apt_desktop="blender filezilla firefox gh gimp gpxsee inkscape kdenlive \ + keepassxc kicad libreoffice obs-studio openvpn prusa-slicer \ + pulseview qbittorrent rpi-imager spotify-client steam-installer \ + vlc" +apt_utilities="bmon ffmpeg fio flatpak gnome-system-monitor gparted htop iotop \ + iperf3 neofetch pv qdirstat rsync screen smartmontools tmux \ unattended-upgrades vim x11-apps xcowsay zoxide" -# TODO: onboard FPGA toolchains (Vivado, @sifferman/tangnano_example) -# TODO: onboard Rust toolchains? +# TODO: add desktop FPGA toolchains (Vivado) and STM32Cube apt_programming="ant cmake code git make openjdk-17-jre-headless openocd \ - stlink-tools" + rustup stlink-tools" +apt_fpga="cmake libboost-dev libboost-filesystem-dev libboost-thread-dev \ + libboost-program-options-dev libboost-iostreams-dev libboost-dev \ + libeigen3-dev" apt_rpi="proot qemu-user-static qemu-utils" # Required by: Bazel, Global Python Packages, apt_install_deps="golang pipx python3 python3-pip" +# https://flathub.org +# TODO: Any of these important? https://flathub.org/apps/category/System/1 +flatpak_desktop="com.discordapp.Discord com.hunterwittenborn.Celeste \ + io.github.brunofin.Cohesion io.github.nokse22.Exhibit \ + io.github.pwr_solaar.solaar io.github.shiftey.Desktop \ + org.stellarium.Stellarium" + pip_packages=("black" "pyserial" "youtube_dl") +# OSS Gowin bitstream tools: https://github.com/YosysHQ/apicula +pip_fpga=("fusesoc" "apycula") # ------------------------------------------------------------------------------ apt_packages="" # Filled in later # https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions -[[ $install_apt_utilities = true ]] && apt_packages="${apt_packages} ${apt_utilities}" -[[ $install_apt_programming = true ]] && apt_packages="${apt_packages} ${apt_programming}" -[[ $install_apt_rpi = true ]] && apt_packages="${apt_packages} ${apt_rpi}" -[[ $install_apt_install_deps = true ]] && apt_packages="${apt_packages} ${apt_install_deps}" +[ $install_apt_desktop = true ] && apt_packages="${apt_packages} ${apt_desktop}" +[ $install_apt_utilities = true ] && apt_packages="${apt_packages} ${apt_utilities}" +[ $install_apt_programming = true ] && apt_packages="${apt_packages} ${apt_programming}" +[ $install_fpga = true ] && apt_packages="${apt_packages} ${apt_fpga}" +[ $install_apt_rpi = true ] && apt_packages="${apt_packages} ${apt_rpi}" +[ $install_apt_install_deps = true ] && apt_packages="${apt_packages} ${apt_install_deps}" +# https://linuxsimply.com/bash-scripting-tutorial/array/array-operations/array-append +[ $install_fpga = true ] && pip_packages=(${pip_packages[@]} ${pip_fpga[@]}) # https://stackoverflow.com/a/36273740/3339274 set -x # Install most-used packages and update all others +if [ $install_desktop ]; then + # https://www.spotify.com/us/download/linux + curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg + echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list + # https://github.com/cli/cli/blob/trunk/docs/install_linux.md + (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ + && sudo mkdir -p -m 755 /etc/apt/keyrings \ + && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + # https://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee + echo 'deb http://download.opensuse.org/repositories/home:/tumic:/GPXSee/xUbuntu_24.04/ /' | sudo tee /etc/apt/sources.list.d/home:tumic:GPXSee.list + curl -fsSL https://download.opensuse.org/repositories/home:tumic:GPXSee/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_tumic_GPXSee.gpg > /dev/null +fi sudo apt update sudo apt full-upgrade -y sudo apt install -y $apt_packages +if [ $install_desktop ]; then + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + flatpak install -y $flatpak_desktop +fi # Patch for Zoxide installation (not yet in apt sources) # https://github.com/ajeetdsouza/zoxide curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh @@ -85,6 +126,50 @@ elif uname -m | grep "aarch64" > /dev/null; then go install github.com/bazelbuild/bazelisk@latest fi +# ------------------------------------------------------------------------------ +# Tools init +# ------------------------------------------------------------------------------ + +# FPGAs? +if [ $install_fpga ]; then + echo "Installing OSS FPGA toolchain" + # fusesoc init # Deprecated at some point? + + # Install OSS CAD Suite: https://github.com/YosysHQ/oss-cad-suite-build + if ! which yosys > /dev/null; then + # Download the right binary! + if uname -m | grep "x86_64" > /dev/null; then + echo "Installing x86 oss-cad-suite..." + wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-x64-20240904.tgz" + elif uname -m | grep "aarch64" > /dev/null; then + echo "Installing aarch64 oss-cad-suite..." + wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-arm64-20240904.tgz" + fi + + # https://superuser.com/a/1601085/342885 + pv oss-cad-suite.tgz | tar -xz + rm oss-cad-suite.tgz + # TODO: Should more directories be copied over? + sudo cp oss-cad-suite/bin/* /usr/local/bin/ + sudo cp -r oss-cad-suite/lib/* /usr/local/lib/ + sudo mkdir -p /usr/local/libexec + sudo cp -r oss-cad-suite/libexec/* /usr/local/libexec + sudo cp -r oss-cad-suite/share/* /usr/local/share + rm -rf oss-cad-suite + else + echo "Skipping OSS Cad Suite install, it already exists!" + fi + + # Install nextpnr-gowin (not yet packaged with OSS CAD Suite) + git clone https://github.com/YosysHQ/nextpnr + cd nextpnr + cmake . -DARCH=gowin + make -j${build_threads} + sudo make install + cd .. + rm -rf nextpnr +fi + # Generate SSH keys if [ ! -d ~/.ssh ]; then mkdir ~/.ssh From ac3871e7b0d18d989c4ebe4148b2c7dd1a4559a5 Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Wed, 4 Sep 2024 00:09:39 -0700 Subject: [PATCH 3/9] Add CLI args to system_setup.sh --- Linux/system_setup.sh | 67 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index 5ed4434..8a05938 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -1,18 +1,18 @@ #!/bin/bash # ------------------------------------------------------------------------------ -# Flags and Settings +# Default Flags and Settings # ------------------------------------------------------------------------------ # Clone git repo or just fetch relevant files clone_repo=true # Set which package categories to install install_apt_desktop=false # Packages for Desktop Linux -install_apt_utilities=true # CLI utilities -install_apt_programming=true # Programming tools -install_fpga=true # FPGA programming tools -install_apt_rpi=true # Raspberry Pi config tools +install_apt_utilities=false # CLI utilities +install_apt_programming=false # Programming tools +install_fpga=false # FPGA programming tools +install_apt_rpi=false # Raspberry Pi config tools install_apt_install_deps=true # Install dependencies for other packages - # should really never be turned off + # Thread count for Make builds # Consider only using 1/2 threads on Raspberry Pi to prevent >1G RAM usage from # hitting the swapfile and TANKING build performance @@ -52,6 +52,40 @@ pip_packages=("black" "pyserial" "youtube_dl") pip_fpga=("fusesoc" "apycula") # ------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ +# Parse CLI args +# ------------------------------------------------------------------------------ +# https://linuxconfig.org/bash-script-flags-usage-with-arguments-examples +while getopts 'Cn:dupfrD' OPTION; do + case "$OPTION" in + C) clone_repo=false;; + n) build_threads=$OPTARG;; + d) install_apt_desktop=true;; + u) install_apt_utilities=true;; + p) install_apt_programming=true;; + f) install_fpga=true;; + r) install_apt_rpi=true;; + D) install_apt_install_deps=false;; + ?) + echo -e "$(basename $0) [-C] [-n] [-d] [-u] [-p] [-f] [-r] [-D]" >&2 + echo -e "-C\tDON'T clone the @neilbalch/Configurations repository to $HOME" >&2 + echo -e "-n\tSet number of make build threads (defaults to $(nproc))" >&2 + echo -e "-d\tInstall packages for Desktop Linux" >&2 + echo -e "-u\tInstall CLI utilities" >&2 + echo -e "-p\tInstall programming tools" >&2 + echo -e "-f\tInstall FPGA programming tools" >&2 + echo -e "-r\tInstall Raspberry Pi config tools" >&2 + echo -e "-D\tDON'T install dependencies for other packages (why?)" >&2 + exit 1 + ;; + esac +done +shift "$(($OPTIND -1))" + +# ------------------------------------------------------------------------------ +# apt and flatpak installs +# ------------------------------------------------------------------------------ + apt_packages="" # Filled in later # https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions [ $install_apt_desktop = true ] && apt_packages="${apt_packages} ${apt_desktop}" @@ -160,14 +194,19 @@ if [ $install_fpga ]; then echo "Skipping OSS Cad Suite install, it already exists!" fi - # Install nextpnr-gowin (not yet packaged with OSS CAD Suite) - git clone https://github.com/YosysHQ/nextpnr - cd nextpnr - cmake . -DARCH=gowin - make -j${build_threads} - sudo make install - cd .. - rm -rf nextpnr + if ! which nextpnr-gowin > /dev/null; then + # Install nextpnr-gowin (not yet packaged with OSS CAD Suite) + git clone https://github.com/YosysHQ/nextpnr + cd nextpnr + cmake . -DARCH=gowin + make -j${build_threads} + sudo make install + cd .. + rm -rf nextpnr + else + echo "Skipping nextpnr-gowin install, it already exists!" + fi + fi # Generate SSH keys From 0e0313b2e771780c6cc3327706dbebeda2152aa9 Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Wed, 4 Sep 2024 20:18:33 -0700 Subject: [PATCH 4/9] Refactor to functions and fix rustup --- Linux/system_setup.sh | 364 ++++++++++++++++++++++-------------------- 1 file changed, 192 insertions(+), 172 deletions(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index 8a05938..f34b961 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -32,7 +32,7 @@ apt_utilities="bmon ffmpeg fio flatpak gnome-system-monitor gparted htop iotop \ unattended-upgrades vim x11-apps xcowsay zoxide" # TODO: add desktop FPGA toolchains (Vivado) and STM32Cube apt_programming="ant cmake code git make openjdk-17-jre-headless openocd \ - rustup stlink-tools" + stlink-tools" apt_fpga="cmake libboost-dev libboost-filesystem-dev libboost-thread-dev \ libboost-program-options-dev libboost-iostreams-dev libboost-dev \ libeigen3-dev" @@ -52,208 +52,228 @@ pip_packages=("black" "pyserial" "youtube_dl") pip_fpga=("fusesoc" "apycula") # ------------------------------------------------------------------------------ -# ------------------------------------------------------------------------------ -# Parse CLI args -# ------------------------------------------------------------------------------ -# https://linuxconfig.org/bash-script-flags-usage-with-arguments-examples -while getopts 'Cn:dupfrD' OPTION; do - case "$OPTION" in - C) clone_repo=false;; - n) build_threads=$OPTARG;; - d) install_apt_desktop=true;; - u) install_apt_utilities=true;; - p) install_apt_programming=true;; - f) install_fpga=true;; - r) install_apt_rpi=true;; - D) install_apt_install_deps=false;; - ?) - echo -e "$(basename $0) [-C] [-n] [-d] [-u] [-p] [-f] [-r] [-D]" >&2 - echo -e "-C\tDON'T clone the @neilbalch/Configurations repository to $HOME" >&2 - echo -e "-n\tSet number of make build threads (defaults to $(nproc))" >&2 - echo -e "-d\tInstall packages for Desktop Linux" >&2 - echo -e "-u\tInstall CLI utilities" >&2 - echo -e "-p\tInstall programming tools" >&2 - echo -e "-f\tInstall FPGA programming tools" >&2 - echo -e "-r\tInstall Raspberry Pi config tools" >&2 - echo -e "-D\tDON'T install dependencies for other packages (why?)" >&2 - exit 1 - ;; - esac -done -shift "$(($OPTIND -1))" - # ------------------------------------------------------------------------------ # apt and flatpak installs # ------------------------------------------------------------------------------ +apt_and_flatpak() { + apt_packages="" # Filled in later + # https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions + [ $install_apt_desktop = true ] && apt_packages="${apt_packages} ${apt_desktop}" + [ $install_apt_utilities = true ] && apt_packages="${apt_packages} ${apt_utilities}" + [ $install_apt_programming = true ] && apt_packages="${apt_packages} ${apt_programming}" + [ $install_fpga = true ] && apt_packages="${apt_packages} ${apt_fpga}" + [ $install_apt_rpi = true ] && apt_packages="${apt_packages} ${apt_rpi}" + [ $install_apt_install_deps = true ] && apt_packages="${apt_packages} ${apt_install_deps}" + # https://linuxsimply.com/bash-scripting-tutorial/array/array-operations/array-append + [ $install_fpga = true ] && pip_packages=(${pip_packages[@]} ${pip_fpga[@]}) -apt_packages="" # Filled in later -# https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions -[ $install_apt_desktop = true ] && apt_packages="${apt_packages} ${apt_desktop}" -[ $install_apt_utilities = true ] && apt_packages="${apt_packages} ${apt_utilities}" -[ $install_apt_programming = true ] && apt_packages="${apt_packages} ${apt_programming}" -[ $install_fpga = true ] && apt_packages="${apt_packages} ${apt_fpga}" -[ $install_apt_rpi = true ] && apt_packages="${apt_packages} ${apt_rpi}" -[ $install_apt_install_deps = true ] && apt_packages="${apt_packages} ${apt_install_deps}" -# https://linuxsimply.com/bash-scripting-tutorial/array/array-operations/array-append -[ $install_fpga = true ] && pip_packages=(${pip_packages[@]} ${pip_fpga[@]}) + # Install most-used packages and update all others + if [ $install_desktop ]; then + # https://www.spotify.com/us/download/linux + curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg + echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list + # https://github.com/cli/cli/blob/trunk/docs/install_linux.md + (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ + && sudo mkdir -p -m 755 /etc/apt/keyrings \ + && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + # https://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee + echo 'deb http://download.opensuse.org/repositories/home:/tumic:/GPXSee/xUbuntu_24.04/ /' | sudo tee /etc/apt/sources.list.d/home:tumic:GPXSee.list + curl -fsSL https://download.opensuse.org/repositories/home:tumic:GPXSee/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_tumic_GPXSee.gpg > /dev/null + fi + sudo apt update + sudo apt full-upgrade -y + sudo apt install -y $apt_packages + if [ $install_desktop ]; then + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + flatpak install -y $flatpak_desktop + fi + # https://stackoverflow.com/a/8880625/3339274 + for i in "${pip_packages[@]}"; do + # :rolling_eyes: https://stackoverflow.com/a/75722775/3339274 + pipx install "$i" + done -# https://stackoverflow.com/a/36273740/3339274 -set -x + # Patch for Zoxide installation (not yet in apt sources) + # https://github.com/ajeetdsouza/zoxide + curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh -# Install most-used packages and update all others -if [ $install_desktop ]; then - # https://www.spotify.com/us/download/linux - curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg - echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list - # https://github.com/cli/cli/blob/trunk/docs/install_linux.md - (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ - && sudo mkdir -p -m 755 /etc/apt/keyrings \ - && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ - && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ - && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null - # https://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee - echo 'deb http://download.opensuse.org/repositories/home:/tumic:/GPXSee/xUbuntu_24.04/ /' | sudo tee /etc/apt/sources.list.d/home:tumic:GPXSee.list - curl -fsSL https://download.opensuse.org/repositories/home:tumic:GPXSee/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_tumic_GPXSee.gpg > /dev/null -fi -sudo apt update -sudo apt full-upgrade -y -sudo apt install -y $apt_packages -if [ $install_desktop ]; then - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - flatpak install -y $flatpak_desktop -fi -# Patch for Zoxide installation (not yet in apt sources) -# https://github.com/ajeetdsouza/zoxide -curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh -# https://stackoverflow.com/a/8880625/3339274 -for i in "${pip_packages[@]}"; do - # :rolling_eyes: https://stackoverflow.com/a/75722775/3339274 - pipx install "$i" -done + if [ $install_apt_programming ]; then + # Rustup is not in apt, only in snap 🤮 + # https://rust-lang.github.io/rustup/installation/other.html + curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y + echo "# Init Rust environment\nsource \"$HOME/.cargo/env\"\n" >> $HOME/.bashrc + fi +} # ------------------------------------------------------------------------------ # Platform-specific installations # ------------------------------------------------------------------------------ -if uname -m | grep "x86_64" > /dev/null; then - echo "Installing x86 apps..." - # Install Bazel - # https://bazel.build/install/ubuntu - sudo apt install apt-transport-https curl gnupg -y - curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg - sudo mv bazel-archive-keyring.gpg /usr/share/keyrings - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list - sudo apt update - sudo apt install bazel -y +platform() { + if uname -m | grep "x86_64" > /dev/null; then + echo "Installing x86 apps..." + # Install Bazel + # https://bazel.build/install/ubuntu + sudo apt install apt-transport-https curl gnupg -y + curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg + sudo mv bazel-archive-keyring.gpg /usr/share/keyrings + echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list + sudo apt update + sudo apt install bazel -y - # If WSL2, then do the legwork to enable usbipd - # https://github.com/dorssel/usbipd-win/wiki/WSL-support - echo "Installing WSL2 usbipd tools..." - if uname -a | grep "WSL2" > /dev/null || uname -a | grep "Microsoft" > /dev/null; then - sudo apt install linux-tools-virtual hwdata - sudo update-alternatives --install /usr/local/bin/usbip usbip `ls /usr/lib/linux-tools/*/usbip | tail -n1` 20 + # If WSL2, then do the legwork to enable usbipd + # https://github.com/dorssel/usbipd-win/wiki/WSL-support + echo "Installing WSL2 usbipd tools..." + if uname -a | grep "WSL2" > /dev/null || uname -a | grep "Microsoft" > /dev/null; then + sudo apt install linux-tools-virtual hwdata + sudo update-alternatives --install /usr/local/bin/usbip usbip `ls /usr/lib/linux-tools/*/usbip | tail -n1` 20 + fi + elif uname -m | grep "aarch64" > /dev/null; then + echo "Installing aarch64 apps..." + # Install Bazel through Bazelisk, then use `bazelisk ...` instead of `bazel ...` + # https://bazel.build/versions/6.4.0/install/bazelisk + # https://github.com/bazelbuild/bazelisk?tab=readme-ov-file#requirements + go install github.com/bazelbuild/bazelisk@latest fi -elif uname -m | grep "aarch64" > /dev/null; then - echo "Installing aarch64 apps..." - # Install Bazel through Bazelisk, then use `bazelisk ...` instead of `bazel ...` - # https://bazel.build/versions/6.4.0/install/bazelisk - # https://github.com/bazelbuild/bazelisk?tab=readme-ov-file#requirements - go install github.com/bazelbuild/bazelisk@latest -fi +} # ------------------------------------------------------------------------------ # Tools init # ------------------------------------------------------------------------------ +tools() { + # FPGAs?` + if [ $install_fpga ]; then + echo "Installing OSS FPGA toolchain" + # fusesoc init # Deprecated at some point? -# FPGAs? -if [ $install_fpga ]; then - echo "Installing OSS FPGA toolchain" - # fusesoc init # Deprecated at some point? + # Install OSS CAD Suite: https://github.com/YosysHQ/oss-cad-suite-build + if ! which yosys > /dev/null; then + # Download the right binary! + if uname -m | grep "x86_64" > /dev/null; then + echo "Installing x86 oss-cad-suite..." + wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-x64-20240904.tgz" + elif uname -m | grep "aarch64" > /dev/null; then + echo "Installing aarch64 oss-cad-suite..." + wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-arm64-20240904.tgz" + fi - # Install OSS CAD Suite: https://github.com/YosysHQ/oss-cad-suite-build - if ! which yosys > /dev/null; then - # Download the right binary! - if uname -m | grep "x86_64" > /dev/null; then - echo "Installing x86 oss-cad-suite..." - wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-x64-20240904.tgz" - elif uname -m | grep "aarch64" > /dev/null; then - echo "Installing aarch64 oss-cad-suite..." - wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-arm64-20240904.tgz" + # https://superuser.com/a/1601085/342885 + pv oss-cad-suite.tgz | tar -xz + rm oss-cad-suite.tgz + # TODO: Should more directories be copied over? + sudo cp oss-cad-suite/bin/* /usr/local/bin/ + sudo cp -r oss-cad-suite/lib/* /usr/local/lib/ + sudo mkdir -p /usr/local/libexec + sudo cp -r oss-cad-suite/libexec/* /usr/local/libexec + sudo cp -r oss-cad-suite/share/* /usr/local/share + rm -rf oss-cad-suite + else + echo "Skipping OSS Cad Suite install, it already exists!" fi - # https://superuser.com/a/1601085/342885 - pv oss-cad-suite.tgz | tar -xz - rm oss-cad-suite.tgz - # TODO: Should more directories be copied over? - sudo cp oss-cad-suite/bin/* /usr/local/bin/ - sudo cp -r oss-cad-suite/lib/* /usr/local/lib/ - sudo mkdir -p /usr/local/libexec - sudo cp -r oss-cad-suite/libexec/* /usr/local/libexec - sudo cp -r oss-cad-suite/share/* /usr/local/share - rm -rf oss-cad-suite - else - echo "Skipping OSS Cad Suite install, it already exists!" - fi + if ! which nextpnr-gowin > /dev/null; then + # Install nextpnr-gowin (not yet packaged with OSS CAD Suite) + git clone https://github.com/YosysHQ/nextpnr + cd nextpnr + cmake . -DARCH=gowin + make -j${build_threads} + sudo make install + cd .. + rm -rf nextpnr + else + echo "Skipping nextpnr-gowin install, it already exists!" + fi - if ! which nextpnr-gowin > /dev/null; then - # Install nextpnr-gowin (not yet packaged with OSS CAD Suite) - git clone https://github.com/YosysHQ/nextpnr - cd nextpnr - cmake . -DARCH=gowin - make -j${build_threads} - sudo make install - cd .. - rm -rf nextpnr - else - echo "Skipping nextpnr-gowin install, it already exists!" fi -fi - -# Generate SSH keys -if [ ! -d ~/.ssh ]; then - mkdir ~/.ssh - ssh-keygen -f ~/.ssh/id_rsa -N "" -fi + # Generate SSH keys + if [ ! -d ~/.ssh ]; then + mkdir ~/.ssh + ssh-keygen -f ~/.ssh/id_rsa -N "" + fi +} # ------------------------------------------------------------------------------ # Apply customizations from @neilbalch/Configurations repo # ------------------------------------------------------------------------------ -if [ $clone_repo = true ]; then - if [ ! -d ~/Configurations ]; then - git clone https://github.com/neilbalch/Configurations.git ~/Configurations +configurations() { + if [ $clone_repo = true ]; then + if [ ! -d ~/Configurations ]; then + git clone https://github.com/neilbalch/Configurations.git ~/Configurations + fi + + # Apply dotfiles + cp ~/Configurations/Linux/.sshConfig ~/.ssh/config + cp ~/Configurations/Linux/.bashrc ~/ + cp ~/Configurations/Linux/.vimrc ~/ + mkdir -p $HOME/.cache/vim/swapfiles + mkdir -p /root + sudo cp ~/Configurations/Linux/.vimrc /root/ + sudo mkdir -p /root/.cache/vim/swapfiles + cp ~/Configurations/Linux/.gitconfig ~/ + + # Install vscode extensions + cp ~/Configurations/VSCode/extensions_list.txt . + python3 ~/Configurations/VSCode/extension_installer.py + rm extensions_list.txt + else + # Apply dotfiles + wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.sshConfig -O ~/.ssh/config + wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.bashrc -O ~/.bashrc + wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.vimrc -O ~/.vimrc + mkdir -p $HOME/.cache/vim/swapfiles + mkdir -p /root + sudo wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.vimrc -O /root/.vimrc + sudo mkdir -p /root/.cache/vim/swapfiles + wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.gitconfig -O ~/.gitconfig + + # Install vscode extensions + wget https://raw.githubusercontent.com/neilbalch/Configurations/master/VSCode/extension_installer.py + wget https://raw.githubusercontent.com/neilbalch/Configurations/master/VSCode/extensions_list.txt + ./extension_installer.py + rm extension_installer.py extensions_list.txt fi +} - # Apply dotfiles - cp ~/Configurations/Linux/.sshConfig ~/.ssh/config - cp ~/Configurations/Linux/.bashrc ~/ - cp ~/Configurations/Linux/.vimrc ~/ - mkdir -p $HOME/.cache/vim/swapfiles - mkdir -p /root - sudo cp ~/Configurations/Linux/.vimrc /root/ - sudo mkdir -p /root/.cache/vim/swapfiles - cp ~/Configurations/Linux/.gitconfig ~/ +# Debug mode: https://stackoverflow.com/a/36273740/3339274 +# set -x - # Install vscode extensions - cp ~/Configurations/VSCode/extensions_list.txt . - python3 ~/Configurations/VSCode/extension_installer.py - rm extensions_list.txt -else - # Apply dotfiles - wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.sshConfig -O ~/.ssh/config - wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.bashrc -O ~/.bashrc - wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.vimrc -O ~/.vimrc - mkdir -p $HOME/.cache/vim/swapfiles - mkdir -p /root - sudo wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.vimrc -O /root/.vimrc - sudo mkdir -p /root/.cache/vim/swapfiles - wget https://raw.githubusercontent.com/neilbalch/Configurations/master/Linux/.gitconfig -O ~/.gitconfig +# ------------------------------------------------------------------------------ +# Parse CLI args +# ------------------------------------------------------------------------------ +# https://linuxconfig.org/bash-script-flags-usage-with-arguments-examples +while getopts 'Cn:dupfrD' OPTION; do + case "$OPTION" in + C) clone_repo=false;; + n) build_threads=$OPTARG;; + d) install_apt_desktop=true;; + u) install_apt_utilities=true;; + p) install_apt_programming=true;; + f) install_fpga=true;; + r) install_apt_rpi=true;; + D) install_apt_install_deps=false;; + ?) + echo -e "$(basename $0) [-C] [-n] [-d] [-u] [-p] [-f] [-r] [-D]" >&2 + echo -e "-C\tDON'T clone the @neilbalch/Configurations repository to $HOME" >&2 + echo -e "-n\tSet number of make build threads (defaults to $(nproc))" >&2 + echo -e "-d\tInstall packages for Desktop Linux" >&2 + echo -e "-u\tInstall CLI utilities" >&2 + echo -e "-p\tInstall programming tools" >&2 + echo -e "-f\tInstall FPGA programming tools" >&2 + echo -e "-r\tInstall Raspberry Pi config tools" >&2 + echo -e "-D\tDON'T install dependencies for other packages (why?)" >&2 + exit 1 + ;; + esac +done +shift "$(($OPTIND -1))" - # Install vscode extensions - wget https://raw.githubusercontent.com/neilbalch/Configurations/master/VSCode/extension_installer.py - wget https://raw.githubusercontent.com/neilbalch/Configurations/master/VSCode/extensions_list.txt - ./extension_installer.py - rm extension_installer.py extensions_list.txt -fi +# Invoke all the things +apt_and_flatpak +platform +tools +configurations # Just for fun :) neofetch From 5e8c56cddb8f575db3d86cb4759a3d565a39001a Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Wed, 4 Sep 2024 22:47:38 -0700 Subject: [PATCH 5/9] Add build apps --- Linux/Balch NAS Config/HOWTO.md | 23 --- Linux/Balch NAS Config/smb.conf | 255 -------------------------------- Linux/system_setup.sh | 101 ++++++++++--- README.md | 3 +- 4 files changed, 78 insertions(+), 304 deletions(-) delete mode 100644 Linux/Balch NAS Config/HOWTO.md delete mode 100644 Linux/Balch NAS Config/smb.conf diff --git a/Linux/Balch NAS Config/HOWTO.md b/Linux/Balch NAS Config/HOWTO.md deleted file mode 100644 index 1ac960b..0000000 --- a/Linux/Balch NAS Config/HOWTO.md +++ /dev/null @@ -1,23 +0,0 @@ -# How to create - -## Resources - -http://www.penguintutor.com/linux/file-permissions-reference -https://www.samba.org/samba/docs/old/Samba3-HOWTO/speed.html -https://www.jeremymorgan.com/tutorials/raspberry-pi/how-to-raspberry-pi-file-server/ -https://askubuntu.com/questions/79078/how-to-restart-samba-server - -## Commands - -- `sudo apt install samba samba-common-bin ntfs-3g` -- `git clone https://github.com/neilbalch/Configurations` -- `sudo mkdir /home/NAS` -- `sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /home/NAS` -- `sudo chmod -R 775 /home/NAS` -- `sudo useradd -g users media && sudo smbpasswd -a media` -- Modify `/etc/samba/smb.conf` with contents from cloned repo -- `testparm` -- `sudo service smbd start` -- All is working okay? - - `sudo vim /etc/rc.local` (Add to bottom, but before `exit 0`) - - `sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /home/NAS` diff --git a/Linux/Balch NAS Config/smb.conf b/Linux/Balch NAS Config/smb.conf deleted file mode 100644 index a756298..0000000 --- a/Linux/Balch NAS Config/smb.conf +++ /dev/null @@ -1,255 +0,0 @@ -# -# Sample configuration file for the Samba suite for Debian GNU/Linux. -# -# -# This is the main Samba configuration file. You should read the -# smb.conf(5) manual page in order to understand the options listed -# here. Samba has a huge number of configurable options most of which -# are not shown in this example -# -# Some options that are often worth tuning have been included as -# commented-out examples in this file. -# - When such options are commented with ";", the proposed setting -# differs from the default Samba behaviour -# - When commented with "#", the proposed setting is the default -# behaviour of Samba but the option is considered important -# enough to be mentioned here -# -# NOTE: Whenever you modify this file you should run the command -# "testparm" to check that you have not made any basic syntactic -# errors. - -#======================= Global Settings ======================= - -[global] - -## Browsing/Identification ### - -# Change this to the workgroup/NT-domain name your Samba server will part of - workgroup = WORKGROUP - -#### Networking #### - -# The specific set of interfaces / networks to bind to -# This can be either the interface name or an IP address/netmask; -# interface names are normally preferred -; interfaces = 127.0.0.0/8 eth0 - -# Only bind to the named interfaces and/or networks; you must use the -# 'interfaces' option above to use this. -# It is recommended that you enable this feature if your Samba machine is -# not protected by a firewall or is a firewall itself. However, this -# option cannot handle dynamic or non-broadcast interfaces correctly. -; bind interfaces only = yes - - - -#### Debugging/Accounting #### - -# This tells Samba to use a separate log file for each machine -# that connects - log file = /var/log/samba/log.%m - -# Cap the size of the individual log files (in KiB). - max log size = 1000 - -# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}. -# Append syslog@1 if you want important messages to be sent to syslog too. - logging = file - -# Do something sensible when Samba crashes: mail the admin a backtrace - panic action = /usr/share/samba/panic-action %d - - -####### Authentication ####### - -# Server role. Defines in which mode Samba will operate. Possible -# values are "standalone server", "member server", "classic primary -# domain controller", "classic backup domain controller", "active -# directory domain controller". -# -# Most people will want "standalone server" or "member server". -# Running as "active directory domain controller" will require first -# running "samba-tool domain provision" to wipe databases and create a -# new domain. - server role = standalone server - - obey pam restrictions = yes - -# This boolean parameter controls whether Samba attempts to sync the Unix -# password with the SMB password when the encrypted SMB password in the -# passdb is changed. - unix password sync = yes - -# For Unix password sync to work on a Debian GNU/Linux system, the following -# parameters must be set (thanks to Ian Kahan < for -# sending the correct chat script for the passwd program in Debian Sarge). - passwd program = /usr/bin/passwd %u - passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . - -# This boolean controls whether PAM will be used for password changes -# when requested by an SMB client instead of the program listed in -# 'passwd program'. The default is 'no'. - pam password change = yes - -# This option controls how unsuccessful authentication attempts are mapped -# to anonymous connections - map to guest = bad user - -########## Domains ########### - -# -# The following settings only takes effect if 'server role = primary -# classic domain controller', 'server role = backup domain controller' -# or 'domain logons' is set -# - -# It specifies the location of the user's -# profile directory from the client point of view) The following -# required a [profiles] share to be setup on the samba server (see -# below) -; logon path = \\%N\profiles\%U -# Another common choice is storing the profile in the user's home directory -# (this is Samba's default) -# logon path = \\%N\%U\profile - -# The following setting only takes effect if 'domain logons' is set -# It specifies the location of a user's home directory (from the client -# point of view) -; logon drive = H: -# logon home = \\%N\%U - -# The following setting only takes effect if 'domain logons' is set -# It specifies the script to run during logon. The script must be stored -# in the [netlogon] share -# NOTE: Must be store in 'DOS' file format convention -; logon script = logon.cmd - -# This allows Unix users to be created on the domain controller via the SAMR -# RPC pipe. The example command creates a user account with a disabled Unix -# password; please adapt to your needs -; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u - -# This allows machine accounts to be created on the domain controller via the -# SAMR RPC pipe. -# The following assumes a "machines" group exists on the system -; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u - -# This allows Unix groups to be created on the domain controller via the SAMR -# RPC pipe. -; add group script = /usr/sbin/addgroup --force-badname %g - -############ Misc ############ - -# Using the following line enables you to customise your configuration -# on a per machine basis. The %m gets replaced with the netbios name -# of the machine that is connecting -; include = /home/samba/etc/smb.conf.%m - -# Some defaults for winbind (make sure you're not using the ranges -# for something else.) -; idmap config * : backend = tdb -; idmap config * : range = 3000-7999 -; idmap config YOURDOMAINHERE : backend = tdb -; idmap config YOURDOMAINHERE : range = 100000-999999 -; template shell = /bin/bash - -# Setup usershare options to enable non-root users to share folders -# with the net usershare command. - -# Maximum number of usershare. 0 means that usershare is disabled. -# usershare max shares = 100 - -# Allow users who've been granted usershare privileges to create -# public shares, not just authenticated ones - usershare allow guests = yes - -#======================= Share Definitions ======================= - -[homes] - comment = Home Directories - browseable = no - -# By default, the home directories are exported read-only. Change the -# next parameter to 'no' if you want to be able to write to them. - read only = yes - -# File creation mask is set to 0700 for security reasons. If you want to -# create files with group=rw permissions, set next parameter to 0775. - create mask = 0700 - -# Directory creation mask is set to 0700 for security reasons. If you want to -# create dirs. with group=rw permissions, set next parameter to 0775. - directory mask = 0700 - -# By default, \\server\username shares can be connected to by anyone -# with access to the samba server. -# The following parameter makes sure that only "username" can connect -# to \\server\username -# This might need tweaking when using external authentication schemes - valid users = %S - -# Un-comment the following and create the netlogon directory for Domain Logons -# (you need to configure Samba to act as a domain controller too.) -;[netlogon] -; comment = Network Logon Service -; path = /home/samba/netlogon -; guest ok = yes -; read only = yes - -# Un-comment the following and create the profiles directory to store -# users profiles (see the "logon path" option above) -# (you need to configure Samba to act as a domain controller too.) -# The path below should be writable by all users so that their -# profile directory may be created the first time they log on -;[profiles] -; comment = Users profiles -; path = /home/samba/profiles -; guest ok = no -; browseable = no -; create mask = 0600 -; directory mask = 0700 - -[printers] - comment = All Printers - browseable = no - path = /var/spool/samba - printable = yes - guest ok = no - read only = yes - create mask = 0700 - -# Windows clients look for this share name as a source of downloadable -# printer drivers -[print$] - comment = Printer Drivers - path = /var/lib/samba/printers - browseable = yes - read only = yes - guest ok = no -# Uncomment to allow remote administration of Windows print drivers. -# You may need to replace 'lpadmin' with the name of the group your -# admin users are members of. -# Please note that you also need to set appropriate Unix permissions -# to the drivers directory for these users to have write rights in it -; write list = root, @lpadmin - -[RPi NAS] - comment = Family NAS - path = /home/NAS - valid users = @users - create mask = 0774 - directory mask = 0775 - browseable = yes - read only = no - writeable = yes - -[Backup] - comment = Family NAS Backup — Weekly on Sunday @ 00:00 - path = /home/Backup - valid users = @users - create mask = 0774 - directory mask = 0775 - browseable = yes - read only = no - writeable = yes diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index f34b961..59ee740 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -6,23 +6,25 @@ # Clone git repo or just fetch relevant files clone_repo=true # Set which package categories to install -install_apt_desktop=false # Packages for Desktop Linux -install_apt_utilities=false # CLI utilities -install_apt_programming=false # Programming tools -install_fpga=false # FPGA programming tools -install_apt_rpi=false # Raspberry Pi config tools -install_apt_install_deps=true # Install dependencies for other packages +install_desktop=false # Packages for Desktop Linux +install_utilities=false # CLI utilities +install_programming=false # Programming tools +install_fpga=false # FPGA programming tools +install_rpi=false # Raspberry Pi config tools +install_install_deps=true # Install dependencies for other packages # Thread count for Make builds # Consider only using 1/2 threads on Raspberry Pi to prevent >1G RAM usage from # hitting the swapfile and TANKING build performance build_threads=$(nproc) +# OSS CAD Suite build date +oss_build="2024-09-04" # ------------------------------------------------------------------------------ # Package Lists # ------------------------------------------------------------------------------ -# TODO: add desktop tools (Resolve, Legion toolkit, Nvidia/AMD/Intel driver, -# OpenRocket, RealVNC Viewer, Teamviewer, TI Connect CE) -# Fusion 360? https://github.com/cryinkfly/Autodesk-Fusion-360-for-Linux +# TODO: add GPU driver instlalls? (Nvidia/AMD/Intel) +# TODO: add desktop tools (Resolve, OpenRocket) +# TODO: Fusion 360? https://github.com/cryinkfly/Autodesk-Fusion-360-for-Linux apt_desktop="blender filezilla firefox gh gimp gpxsee inkscape kdenlive \ keepassxc kicad libreoffice obs-studio openvpn prusa-slicer \ pulseview qbittorrent rpi-imager spotify-client steam-installer \ @@ -30,9 +32,13 @@ apt_desktop="blender filezilla firefox gh gimp gpxsee inkscape kdenlive \ apt_utilities="bmon ffmpeg fio flatpak gnome-system-monitor gparted htop iotop \ iperf3 neofetch pv qdirstat rsync screen smartmontools tmux \ unattended-upgrades vim x11-apps xcowsay zoxide" -# TODO: add desktop FPGA toolchains (Vivado) and STM32Cube apt_programming="ant cmake code git make openjdk-17-jre-headless openocd \ stlink-tools" +apt_teamviewer="libminizip1" +apt_sdrpp="g++ make cmake libfftw3-dev libglfw3 libvolk2-dev zstd" +apt_openhantek="g++ make cmake fakeroot qttools5-dev libfftw3-dev binutils-dev \ + libusb-1.0-0-dev libqt5opengl5-dev mesa-common-dev \ + libgl1-mesa-dev libgles2-mesa-dev rpm" apt_fpga="cmake libboost-dev libboost-filesystem-dev libboost-thread-dev \ libboost-program-options-dev libboost-iostreams-dev libboost-dev \ libeigen3-dev" @@ -47,7 +53,9 @@ flatpak_desktop="com.discordapp.Discord com.hunterwittenborn.Celeste \ io.github.pwr_solaar.solaar io.github.shiftey.Desktop \ org.stellarium.Stellarium" -pip_packages=("black" "pyserial" "youtube_dl") +# https://github.com/ytdl-org/youtube-dl +# https://github.com/dlenski/python-vipaccess +pip_packages=("black" "pyserial" "youtube_dl" "python-vipaccess") # OSS Gowin bitstream tools: https://github.com/YosysHQ/apicula pip_fpga=("fusesoc" "apycula") # ------------------------------------------------------------------------------ @@ -58,12 +66,12 @@ pip_fpga=("fusesoc" "apycula") apt_and_flatpak() { apt_packages="" # Filled in later # https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions - [ $install_apt_desktop = true ] && apt_packages="${apt_packages} ${apt_desktop}" - [ $install_apt_utilities = true ] && apt_packages="${apt_packages} ${apt_utilities}" - [ $install_apt_programming = true ] && apt_packages="${apt_packages} ${apt_programming}" + [ $install_desktop = true ] && apt_packages="${apt_packages} ${apt_desktop} ${apt_teamviewer}" + [ $install_utilities = true ] && apt_packages="${apt_packages} ${apt_utilities}" + [ $install_programming = true ] && apt_packages="${apt_packages} ${apt_programming} ${apt_sdrpp} ${apt_openhantek}" [ $install_fpga = true ] && apt_packages="${apt_packages} ${apt_fpga}" - [ $install_apt_rpi = true ] && apt_packages="${apt_packages} ${apt_rpi}" - [ $install_apt_install_deps = true ] && apt_packages="${apt_packages} ${apt_install_deps}" + [ $install_rpi = true ] && apt_packages="${apt_packages} ${apt_rpi}" + [ $install_install_deps = true ] && apt_packages="${apt_packages} ${apt_install_deps}" # https://linuxsimply.com/bash-scripting-tutorial/array/array-operations/array-append [ $install_fpga = true ] && pip_packages=(${pip_packages[@]} ${pip_fpga[@]}) @@ -72,12 +80,14 @@ apt_and_flatpak() { # https://www.spotify.com/us/download/linux curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list + # https://github.com/cli/cli/blob/trunk/docs/install_linux.md (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ && sudo mkdir -p -m 755 /etc/apt/keyrings \ && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + # https://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee echo 'deb http://download.opensuse.org/repositories/home:/tumic:/GPXSee/xUbuntu_24.04/ /' | sudo tee /etc/apt/sources.list.d/home:tumic:GPXSee.list curl -fsSL https://download.opensuse.org/repositories/home:tumic:GPXSee/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_tumic_GPXSee.gpg > /dev/null @@ -85,10 +95,12 @@ apt_and_flatpak() { sudo apt update sudo apt full-upgrade -y sudo apt install -y $apt_packages + if [ $install_desktop ]; then flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install -y $flatpak_desktop fi + # https://stackoverflow.com/a/8880625/3339274 for i in "${pip_packages[@]}"; do # :rolling_eyes: https://stackoverflow.com/a/75722775/3339274 @@ -99,7 +111,7 @@ apt_and_flatpak() { # https://github.com/ajeetdsouza/zoxide curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh - if [ $install_apt_programming ]; then + if [ $install_programming ]; then # Rustup is not in apt, only in snap 🤮 # https://rust-lang.github.io/rustup/installation/other.html curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y @@ -150,12 +162,13 @@ tools() { # Install OSS CAD Suite: https://github.com/YosysHQ/oss-cad-suite-build if ! which yosys > /dev/null; then # Download the right binary! + # https://stackoverflow.com/a/23909383/3339274 if uname -m | grep "x86_64" > /dev/null; then echo "Installing x86 oss-cad-suite..." - wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-x64-20240904.tgz" + wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/${oss_build}/oss-cad-suite-linux-x64-$(date -d ${oss_build} +'%Y%m%d').tgz" elif uname -m | grep "aarch64" > /dev/null; then echo "Installing aarch64 oss-cad-suite..." - wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-09-04/oss-cad-suite-linux-arm64-20240904.tgz" + wget -O oss-cad-suite.tgz "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/${oss_build}/oss-cad-suite-linux-arm64-$(date -d ${oss_build} +'%Y%m%d').tgz" fi # https://superuser.com/a/1601085/342885 @@ -187,6 +200,46 @@ tools() { fi + if [ $install_desktop ] && ! which teamviewer > /dev/null; then + # Teamviewer install + if uname -m | grep "x86_64" > /dev/null; then + echo "Installing x86 Teamviewer..." + wget -O teamviewer.deb "https://download.teamviewer.com/download/linux/teamviewer_amd64.deb" + elif uname -m | grep "aarch64" > /dev/null; then + echo "Installing aarch64 Teamviewer..." + wget -O teamviewer.deb "https://download.teamviewer.com/download/linux/teamviewer_arm64.deb" + fi + + sudo dpkg -i teamviewer.deb + rm teamviewer.deb + fi + + if [ $install_programming ] && ! which sdrpp > /dev/null; then + # Install SDR++ + # https://github.com/AlexandreRouma/SDRPlusPlus?tab=readme-ov-file#building-on-linux--bsd + git clone https://github.com/AlexandreRouma/SDRPlusPlus + mkdir SDRPlusPlus/build + cd SDRPlusPlus/build + cmake .. + make -j${build_threads} + sudo make install + cd ../.. + rm -rf SDRPlusPlus + fi + + if [ $install_programming ] && ! which OpenHantek > /dev/null; then + # Install OpenHantek + # https://github.com/OpenHantek/OpenHantek6022 + git clone https://github.com/OpenHantek/OpenHantek6022 + mkdir OpenHantek6022/build + cd OpenHantek6022/build + cmake .. + make -j${build_threads} + sudo make install + cd ../.. + rm -rf OpenHantek6022 + fi + # Generate SSH keys if [ ! -d ~/.ssh ]; then mkdir ~/.ssh @@ -247,12 +300,12 @@ while getopts 'Cn:dupfrD' OPTION; do case "$OPTION" in C) clone_repo=false;; n) build_threads=$OPTARG;; - d) install_apt_desktop=true;; - u) install_apt_utilities=true;; - p) install_apt_programming=true;; + d) install_desktop=true;; + u) install_utilities=true;; + p) install_programming=true;; f) install_fpga=true;; - r) install_apt_rpi=true;; - D) install_apt_install_deps=false;; + r) install_rpi=true;; + D) install_install_deps=false;; ?) echo -e "$(basename $0) [-C] [-n] [-d] [-u] [-p] [-f] [-r] [-D]" >&2 echo -e "-C\tDON'T clone the @neilbalch/Configurations repository to $HOME" >&2 diff --git a/README.md b/README.md index e537249..ba6e49f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ This repository covers my software configurations for the following applications ## Linux Stuff -- Samba Raspberry Pi NAS Configuration - Raspberry Pi Scripts - `wifi-to-eth-route.service` Wireless bridge `systemctl` service script (*located in `/etc/systemd/system`*) and started on boot by `systemctl` once service is enabled - `wifi-to-eth-route.sh` Bash script that reconfigures the RPi `eth0` LAN port as a wireless bridge from the WiFi connection. Forked from [arpitjindal97/raspbian-recipes](https://github.com/arpitjindal97/raspbian-recipes) @@ -67,7 +66,7 @@ This repository covers my software configurations for the following applications - `debian-restart-network.sh`: Bash script to reset the network interfaces in a Debian VM (*Used briefly for VirtualBox @ FRC971*) - `system_setup.sh`: Bash script to automate personal first-time setup of a Linux installation -## TI84 Plus CE Apps (*Use TI Connect to transfer onto calculator*) +## TI84 Plus CE Apps (*Use [TI Connect](https://education.ti.com/en/products/computer-software/ti-connect-ce-sw) to transfer onto calculator*) Various apps in each subfolder. From 4a41d647270384a50bb72921f94c086f658e36f9 Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Sat, 21 Sep 2024 15:11:51 -0700 Subject: [PATCH 6/9] Change LibreOffice to OnlyOffice --- Linux/system_setup.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index 59ee740..01beb77 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -26,9 +26,8 @@ oss_build="2024-09-04" # TODO: add desktop tools (Resolve, OpenRocket) # TODO: Fusion 360? https://github.com/cryinkfly/Autodesk-Fusion-360-for-Linux apt_desktop="blender filezilla firefox gh gimp gpxsee inkscape kdenlive \ - keepassxc kicad libreoffice obs-studio openvpn prusa-slicer \ - pulseview qbittorrent rpi-imager spotify-client steam-installer \ - vlc" + keepassxc kicad obs-studio openvpn prusa-slicer pulseview \ + qbittorrent rpi-imager spotify-client steam-installer vlc" apt_utilities="bmon ffmpeg fio flatpak gnome-system-monitor gparted htop iotop \ iperf3 neofetch pv qdirstat rsync screen smartmontools tmux \ unattended-upgrades vim x11-apps xcowsay zoxide" @@ -51,7 +50,7 @@ apt_install_deps="golang pipx python3 python3-pip" flatpak_desktop="com.discordapp.Discord com.hunterwittenborn.Celeste \ io.github.brunofin.Cohesion io.github.nokse22.Exhibit \ io.github.pwr_solaar.solaar io.github.shiftey.Desktop \ - org.stellarium.Stellarium" + org.onlyoffice.desktopeditors org.stellarium.Stellarium" # https://github.com/ytdl-org/youtube-dl # https://github.com/dlenski/python-vipaccess From a211a7bceeff2e3366347d4359f732650e674c8e Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Mon, 21 Oct 2024 22:52:38 -0700 Subject: [PATCH 7/9] Typo --- Linux/system_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index 01beb77..b3a62a3 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -153,7 +153,7 @@ platform() { # Tools init # ------------------------------------------------------------------------------ tools() { - # FPGAs?` + # FPGAs? if [ $install_fpga ]; then echo "Installing OSS FPGA toolchain" # fusesoc init # Deprecated at some point? From ed100d1bc10ed86c2a1b07195994ef9b9b33960b Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Mon, 21 Oct 2024 23:13:43 -0700 Subject: [PATCH 8/9] Add annotate-output --- Linux/system_setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index b3a62a3..ffc3dc3 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -28,9 +28,12 @@ oss_build="2024-09-04" apt_desktop="blender filezilla firefox gh gimp gpxsee inkscape kdenlive \ keepassxc kicad obs-studio openvpn prusa-slicer pulseview \ qbittorrent rpi-imager spotify-client steam-installer vlc" -apt_utilities="bmon ffmpeg fio flatpak gnome-system-monitor gparted htop iotop \ - iperf3 neofetch pv qdirstat rsync screen smartmontools tmux \ - unattended-upgrades vim x11-apps xcowsay zoxide" +# devscripts included *only* for `annotate-output` lol +# https://unix.stackexchange.com/a/186570/75035 +apt_utilities="bmon devscripts ffmpeg fio flatpak gnome-system-monitor gparted \ + htop iotop iperf3 neofetch pv qdirstat rsync screen \ + smartmontools tmux unattended-upgrades vim x11-apps xcowsay \ + zoxide" apt_programming="ant cmake code git make openjdk-17-jre-headless openocd \ stlink-tools" apt_teamviewer="libminizip1" From 2a407151b1aedc7fb833e8038f4f572153c5d59a Mon Sep 17 00:00:00 2001 From: Neil Balch Date: Mon, 25 Nov 2024 23:23:37 -0800 Subject: [PATCH 9/9] Add yt-dlp Python package --- Linux/system_setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Linux/system_setup.sh b/Linux/system_setup.sh index ffc3dc3..f8f734b 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -56,8 +56,9 @@ flatpak_desktop="com.discordapp.Discord com.hunterwittenborn.Celeste \ org.onlyoffice.desktopeditors org.stellarium.Stellarium" # https://github.com/ytdl-org/youtube-dl +# https://github.com/yt-dlp/yt-dlp # https://github.com/dlenski/python-vipaccess -pip_packages=("black" "pyserial" "youtube_dl" "python-vipaccess") +pip_packages=("black" "pyserial" "youtube_dl" "yt-dlp" "python-vipaccess") # OSS Gowin bitstream tools: https://github.com/YosysHQ/apicula pip_fpga=("fusesoc" "apycula") # ------------------------------------------------------------------------------