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 22de3c9..f8f734b 100755 --- a/Linux/system_setup.sh +++ b/Linux/system_setup.sh @@ -1,107 +1,335 @@ #!/bin/bash -# https://stackoverflow.com/a/36273740/3339274 -set -x - +# ------------------------------------------------------------------------------ +# Default Flags and Settings +# ------------------------------------------------------------------------------ # Clone git repo or just fetch relevant files clone_repo=true +# Set which package categories to install +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 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 obs-studio openvpn prusa-slicer pulseview \ + qbittorrent rpi-imager spotify-client steam-installer vlc" +# 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" +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" +apt_rpi="proot qemu-user-static qemu-utils" +# Required by: Bazel, Global Python Packages, +apt_install_deps="golang pipx python3 python3-pip" -# 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 -# 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://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.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" "yt-dlp" "python-vipaccess") +# OSS Gowin bitstream tools: https://github.com/YosysHQ/apicula +pip_fpga=("fusesoc" "apycula") # ------------------------------------------------------------------------------ -# Platform-specific installations + +# ------------------------------------------------------------------------------ +# apt and flatpak installs # ------------------------------------------------------------------------------ -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 +apt_and_flatpak() { + apt_packages="" # Filled in later + # https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Conditional_Expressions + [ $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_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[@]}) + + # 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 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..." - 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 + 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 + + # 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 + + 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 + echo "# Init Rust environment\nsource \"$HOME/.cargo/env\"\n" >> $HOME/.bashrc + fi +} + +# ------------------------------------------------------------------------------ +# Platform-specific installations +# ------------------------------------------------------------------------------ +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 + 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 - -# Generate SSH keys -if [ ! -d ~/.ssh ]; then - mkdir ~/.ssh - ssh-keygen -f ~/.ssh/id_rsa -N "" -fi +} + +# ------------------------------------------------------------------------------ +# Tools init +# ------------------------------------------------------------------------------ +tools() { + # 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! + # 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/${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/${oss_build}/oss-cad-suite-linux-arm64-$(date -d ${oss_build} +'%Y%m%d').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 + + 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 + + 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 + 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 +} + +# Debug mode: https://stackoverflow.com/a/36273740/3339274 +# set -x + +# ------------------------------------------------------------------------------ +# 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_desktop=true;; + u) install_utilities=true;; + p) install_programming=true;; + f) install_fpga=true;; + 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 + 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))" - # 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 +# Invoke all the things +apt_and_flatpak +platform +tools +configurations # Just for fun :) neofetch 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.