Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Last active May 24, 2024 15:56
Show Gist options
  • Save pythoninthegrass/0bd8978be0e2f660a82cf7f771a844bf to your computer and use it in GitHub Desktop.
Save pythoninthegrass/0bd8978be0e2f660a82cf7f771a844bf to your computer and use it in GitHub Desktop.
Synology shell config
#/etc/profile: system-wide .profile file for ash.
# shellcheck disable=SC2155
umask 077
export PATH="/volume1/@appstore/git/bin:/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin"
export PGDATA=/var/services/pgsql
export TERMINFO=/usr/share/terminfo
export TERM=${TERM:-cons25}
export PAGER=more
export LC_ALL=en_US.utf8
export LANG=en_US.utf8
# PS1="`hostname`> "
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
HISTFILE=/var/tmp/.bash_history
HISTFILESIZE=100
HISTSIZE=100
stty -ixon
bind '"\e[1~": beginning-of-line' &> /dev/null
bind '"\e[4~": end-of-line' &> /dev/null
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
export PATH=$(echo -n $PATH | awk -v RS=: -v ORS=: '!x[$0]++' | sed "s/\(.*\).\{1\}/\1/")
export HOMEBREW_GIT_PATH=$(command -v git)
export HOMEBREW_NO_INSTALL_CLEANUP=1
# /home/linuxbrew/.linuxbrew/opt/fzf/install
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
alias ..='cd ../'
alias ...='cd ../../'
alias ll='ls -la --color=auto'
alias lzd='lazydocker'
alias rsync='rsync -arvW --progress --stats --ignore-existing' # archive, recursive, verbose, whole-file
unzip() { 7z x "$@" ; }
ulimit -c unlimited
#!/usr/bin/env bash
# SOURCES
# https://community.synology.com/enu/forum/1/post/153781
# shellcheck disable=SC2155
set -euo pipefail
# fake ldd
if [[ ! -f /usr/bin/ldd ]]; then
sudo touch /usr/bin/ldd
cat <<- 'EOF' | sudo tee /usr/bin/ldd
#!/bin/bash
[[ $(/usr/lib/libc.so.6) =~ version\ ([0-9]\.[0-9]+) ]] && echo "ldd ${BASH_REMATCH[1]}"
EOF
fi
# bind mount to get around 2GB quota
sudo mkdir -p /home
sudo mount --bind /volume1/homes /home
sudo chmod 755 /home # Insecure world writable dir ... in PATH, mode 040777
# install linuxbrew
if [[ $(command -v brew; echo $?) != 0 ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
sudo chmod 755 -R /home/linuxbrew
fi
# Add SynoCommunity repo to DSM
# https://synocommunity.com/
# Install git v2.40.1+
export PATH="/volume1/@appstore/git/bin:$PATH"
export HOMEBREW_GIT_PATH=$(command -v git)
export HOMEBREW_NO_INSTALL_CLEANUP=1
# update git,gcc. and make
# * gcc is a dependency for git
brew install automake cmake git make
# general tools
brew install bat fzf gh htop just lazydocker nmap perl p7zip tldr tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment