move other dir to os_and_install

asd
This commit is contained in:
lucas committed 2026-10-15 09:42:59 +00:00
1 parent dbb8eda1e6
commit 9a476ef5cd
10 files changed
+84

No files matched your search

+193
View File
@@ -0,0 +1,193 @@
HOST=$(hostname)
LOCAL_SCRIPTS="/home/lucas/scripts"
alias please="sudo"
alias NC_scripts="cd ${NC_SCRIPTS}"
alias regex_rename="${LOCAL_SCRIPTS}/rename.sh"
alias profile="${LOCAL_SCRIPTS}/profile_motd.sh"
alias auto_update="${LOCAL_SCRIPTS}/utils/upgrade.sh"
alias aptgrep="apt list --installed | grep -i "
alias reboot="sudo /sbin/reboot"
alias shutdown="sudo /sbin/shutdown"
alias sound_up="pactl -- set-sink-volume 0 +10%"
alias TU_vpn="sudo openconnect --user e1629051@student.tuwien.ac.at vpn.tuwien.ac.at"
alias psgrep="ps -elf | grep -v grep | grep -i "
alias vpn="sudo ${LOCAL_SCRIPTS}/network/networksettings.sh"
alias pubip="wget -T 5 -qO- ifconfig.co"
alias pubip_country="wget -T 5 -qO- ifconfig.co/country"
alias ipinfo='${LOCAL_SCRIPTS}/ip_info.sh'
alias pygen="/home/lucas/scripts/.venv/bin/python3"
alias mediawake="bash ${LOCAL_SCRIPTS}/network/wol.sh mediahost -c"
alias serverwake="bash ${LOCAL_SCRIPTS}/network/wol.sh serverhost -c"
alias quietwake="bash ${LOCAL_SCRIPTS}/network/wol.sh quiethost"
if [[ "${HOST}" == "quiethost" ]] || [[ "${HOST}" == "serverhost" ]]; then
### Veracrypt aliases
#Passwd Mount and Grep
alias passwd_mount="sudo veracrypt -t --mount --non-interactive --stdin $DOC_DIR/Dokumente/Zeug/passwd /media/veracrypt_passwd && clear"
alias passwd_dismount="sudo veracrypt --dismount $DOC_DIR/Dokumente/Zeug/passwd && touch $DOC_DIR/Dokumente/Zeug/passwd"
alias passwd_grep="grep -i -A1 /media/veracrypt_passwd/passwd.txt -e "
#System mounts
alias system_mount="sudo veracrypt -t --mount --non-interactive --stdin /data/SystemData/Sys64/System_Data /media/veracrypt_system && clear"
alias system_dismount="sudo veracrypt --dismount /data/SystemData/Sys64/System_Data"
#vera
alias vera_mount="sudo veracrypt -t --mount --non-interactive --stdin //media/veracrypt_system/System32/SystemData/IMG.file /media/veracrypt_vera && clear"
alias vera_dismount="sudo veracrypt --dismount /media/veracrypt_system/System32/SystemData/IMG.file"
#no intenet
alias no_inet="sudo -s -g no-internet"
alias recipeAI="~/.venv_general/bin/python3 ~/scripts/quiethost/generateNutritionInfowithGemini.py /data/Nextcloud/Documents/Dokumente/Shared/Diverses/Kochbuch/RecepiesLucas/"
alias ffmepeg_handling="~/.venv_general/bin/python3 ~/scripts/ffmpeg_handling.py"
fi
if [ "${HOST}" != "serverhost" ]; then
alias serverhost="ssh -X serverhost"
alias lstorr="ssh serverhost du -a -d1 -h /torrent/complete/ | sed 's/\/torrent\/complete\///'g | head -n -1"
alias delugecopy='bash ${LOCAL_SCRIPTS}/copy.sh -h deluge -f '
alias servercopy='bash ${LOCAL_SCRIPTS}/copy.sh -h serverhost -f '
alias scriptcopy="ssh serverhost bash /home/lucas/scripts/scriptcopy.sh"
#Dinfo
alias dinfo="ssh serverhost ${LOCAL_SCRIPTS}/deluge-client.sh"
elif [ "${HOST}" != "vivohost" ];then
# Copy Torrents
alias ytlistdownload="screen -S ytdown bash /home/lucas/scripts/youtube.sh -L"
copytorrents() {
screen -S cptorr bash -c "/home/lucas/scripts/serverhost/copytorrents.sh -l -y $@; read"
}
# Print
alias print="lpr -P hp-LaserJet-1300 "
alias scriptcopy='bash ${LOCAL_SCRIPTS}/scriptcopy.sh'
# Serverhost Network Commands
alias occ_scan="sudo bash ${LOCAL_SCRIPTS}/Nextcloud/nextcloud_scan.sh"
alias netstat="sudo bash ${LOCAL_SCRIPTS}/network/state.sh"
alias routing="sudo ${LOCAL_SCRIPTS}/network/rev_routing.sh"
alias IPtables-save="sudo sh -c 'iptables-save > /etc/network/iptables'"
# Serverhost Deluge Commands
alias rmTorr="bash ${LOCAL_SCRIPTS}/removeTorrents.sh"
alias dadd='duser deluge-console add'
alias deluge="duser deluged && sleep 0.2 && duser deluge-console"
alias deluge-console='duser deluge-console'
alias del='if [[ $(psgrep delug | wc -l) -eq 0 ]]; then vpn; fi; duser deluge-console'
alias deluged="duser deluged"
alias duser="sudo ${LOCAL_SCRIPTS}/serverhost/deluge_user_cmd.sh"
alias dpubip="duser wget -T 5 -qO- ifconfig.co"
alias dpubip_country="duser wget -T 5 -qO- ifconfig.co/country"
alias lstorr="du -a -d1 -h /torrent/complete/ | sed 's/\/torrent\/complete\///'g | head -n -1"
# Serverhost NCSync
alias occ="sudo -u www-data php /nextcloud/nextcloud/occ"
#Dinfo
alias dinfo="${LOCAL_SCRIPTS}/serverhost/deluge-client.sh"
# Wallpaper Changer
alias WC="bash /home/lucas/scripts/serverhost/WallpaperChangerServer.sh"
# Auto shutdown
alias autoshutdown_enable="echo "yes" > /home/lucas/.auto_shutdown"
alias autoshutdown_disable="echo "no" > /home/lucas/.auto_shutdown"
fi
if [ "${HOST}" != "quiethost" ]; then
alias quiethost="ssh -X quiethost"
alias quietcopy='bash ${LOCAL_SCRIPTS}/copy.sh -h quiethost -f '
elif [ "${HOST}" != "vivohost" ];then
# XRDP duser@serverhost
alias serverxrdp="xfreerdp /bpp:32 /kbd:german /u:deluge-user /v:10.0.0.2 /port:3389 /cert-ignore /size:1920x950 /relax-order-checks +glyph-cache"
# Iptables
alias firewall="sudo /home/lucas/Documents/Dokumente/Projekte/Server/scripts/iptables_basic.sh"
# Torrents
alias torrentcopy="bash /home/lucas/scripts/quiethost/torrentcopy.sh"
# Screenshot
alias scrsht="bash /home/lucas/scripts/screenschot_grab.sh"
# Boot to Windows
alias winboot="sudo efibootmgr --bootnext 0000 && reboot"
# Boot to Windows
alias winhiber="sudo /home/lucas/scripts/enable-hibernate-reboot && sudo efibootmgr --bootnext 0003 && sudo systemctl hibernate"
# 3DVS mount
alias 3dvs_mount="sudo veracrypt -t --mount --non-interactive --stdin /data/SystemData/SystemGame3DSV2_10 /media/veracrypt_3DSV && clear"
alias 3dvs_dismount="sudo veracrypt --dismount /data/SystemData/SystemGame3DSV2_10"
# FFMPEG
# jpg2png
alias imconv="bash ${LOCAL_SCRIPTS}/img_type.sh"
alias FFmpeg="bash /home/lucas/scripts/ffmpeg_handling.sh"
# Wallpaper Changer
alias WC="bash /data/Nextcloud/Documents/Dokumente/Projekte/Server/scripts/serverhost/WallpaperChangerServer.sh"
# Display Modes
alias mode_work="xrandr --output HDMI-1-1 --off && bash /home/lucas/scripts/wallpaperChanger.sh"
alias mode_norm="xrandr --output eDP-1-1 --output HDMI-1-1 --auto --primary --left-of eDP-1-1 && bash /home/lucas/scripts/wallpaperChanger.sh"
# Repair Mouse
alias mouse_repair="sudo /home/lucas/scripts/repair_mouse.sh"
alias sd_rm="rm -dr /home/lucas/stable-diffusion-webui/outputs/* /home/lucas/stable-diffusion-webui/log/images/*"
alias stable="cd /stable/stable-diffusion-webui/ && ./webui.sh"
alias comfiUI="cd /stable/ComfyUI/ && HSA_OVERRIDE_GFX_VERSION=10.3.0 python3 main.py"
fi
if [ "${HOST}" != "mediahost" ]; then
alias mediahost="ssh mediahost"
fi
if [ "${HOST}" == "vivohost" ]; then
alias labwake="sudo etherwake B4:2E:99:F1:82:3B -i wlo1"
#alias labhost="ssh ubuntu@LabNotebookUbuntu"
alias labhost="ssh labhost"
alias serverhost="ssh serverhost"
alias WC="bash /home/lucas/scripts/serverhost/WallpaperChangerServer.sh"
alias winboot="sudo efibootmgr --bootnext 0001 && sudo /usr/sbin/reboot"
fi
if [[ "${HOST}" == "quiethost" ]] || [[ "${HOST}" == "vivohost" ]]; then
DEFAULT_SUBNET=11
if [ "${HOST}" == "quiethost" ]; then
DEFAULT_SUBNET=0
fi
alias tcmcli="/usr/bin/python3 ~/git/calibration_gui/supportScripts/send_cli_command_lucas.py"
raspi() { x=$(echo $1 | grep -o '\.' | wc -l) ; if [[ $x -le 0 ]]; then ssh -X raspi@192.168.$DEFAULT_SUBNET.$1; elif [[ $x -eq 1 ]]; then ssh raspi@192.168.$1; elif [[ $x -eq 2 ]] ; then ssh raspi@192.$1; elif [[ $x -eq 3 ]]; then ssh raspi@$1; fi }
fi
dircreate() {
for file in *; do
[ -f "$file" ] || continue
dirname="${file%.*}"
# If no extension exists, use the full filename
[ "$dirname" = "$file" ] && dirname="$file"
mkdir -p "$dirname"
mv "$file" "$dirname/"
done
}
find_multi_video_dirs() {
local exts='mkv|mp4|avi|mov|m4v|wmv|flv|webm|ts'
find . -type d -print0 |
while IFS= read -r -d '' dir; do
count=$(find "$dir" -maxdepth 1 -type f \
| grep -Ei "\.($exts)$" \
| wc -l)
if (( count > 1 )); then
echo "$count videos: $dir"
fi
done
}
rename_dots() {
find . -depth | while IFS= read -r path; do
[[ "$path" == "." ]] && continue
base=$(basename "$path")
dir=$(dirname "$path")
if [[ -f "$path" && "$base" == *.tar.gz ]]; then
name="${base%.tar.gz}"
newbase="${name//./ }.tar.gz"
elif [[ -f "$path" && "$base" == *.* ]]; then
name="${base%.*}"
ext="${base##*.}"
newbase="${name//./ }.${ext}"
else
newbase="${base//./ }"
fi
if [[ "$base" != "$newbase" ]]; then
newpath="$dir/$newbase"
echo "Moving: '$path' -> '$newpath'"
mv -n -- "$path" "$newpath"
fi
done
}
+22
View File
@@ -0,0 +1,22 @@
if [ -f /home/lucas/scripts/profile_motd1.sh ]; then
bash /home/lucas/scripts/profile_motd1.sh
fi
# Eternal Bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# <https://stackoverflow.com/questions/9457233>
# Unlimited Bash history
#
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location, because certain Bash sessions truncate .bash_history file upon close.
# <https://superuser.com/questions/575479>
# Bash history truncated to 500 lines on each login
#
export HISTFILE=~/.bash_eternal_history
# Force prompt to write history after every command.
# <https://superuser.com/questions/20900/bash-history-loss>
# Bash history loss when using histappend
#
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
+15
View File
@@ -0,0 +1,15 @@
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
# sudo apt install nfs-kernel-server
# sudo exportfs -ra
/torrent/qbittorrent/downloads 192.168.0.4(rw,sync,no_subtree_check)
/backup/homeassistant 192.168.0.4(rw,sync,no_subtree_check)
+5
View File
@@ -0,0 +1,5 @@
192.168.0.2 serverhost qbittorrenthost
192.168.0.39 quiethost
192.168.0.4 mediahost
192.168.0.81 vivohost
#192.168.0.122 homeassistant
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -e
echo "Installing packages..."
sudo apt update
sudo apt install -y \
git \
curl \
unzip \
build-essential \
ripgrep \
fd-find \
npm \
pipx \
wl-clipboard \
xclip \
tmux
echo "Installing latest Neovim..."
sudo snap install nvim --classic || true
echo "Refreshing shell..."
hash -r
echo "Installing language servers..."
sudo npm install -g \
pyright \
typescript \
typescript-language-server \
bash-language-server \
prettier \
eslint_d
echo "Installing Python tools..."
pipx install black || true
pipx install isort || true
pipx install debugpy || true
echo "Installing LazyVim..."
mv ~/.config/nvim ~/.config/nvim.bak.$(date +%s) 2>/dev/null || true
mv ~/.local/share/nvim ~/.local/share/nvim.bak.$(date +%s) 2>/dev/null || true
git clone https://github.com/LazyVim/starter ~/.config/nvim
rm -rf ~/.config/nvim/.git
mkdir -p ~/.config/nvim/lua/config
cat > ~/.config/nvim/lua/config/options.lua <<'EOF'
vim.opt.clipboard = "unnamedplus"
-- SSH + terminal copy compatibility
vim.opt.mouse = ""
-- optional
vim.opt.relativenumber = true
vim.opt.number = true
EOF
mkdir -p ~/.config/nvim/lua/plugins
cat > ~/.config/nvim/lua/plugins/debug.lua <<'EOF'
return {
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.lang.python" },
}
EOF
echo
echo "Done."
echo
echo "Start Neovim:"
echo " nvim"
echo
echo "Then run:"
echo " :Lazy sync"
echo " :Mason"
echo
echo "Useful shortcuts:"
echo " Space Space Find files"
echo " Space / Search text"
echo " Space c f Format file"
echo " Space d b Toggle breakpoint"
echo " Space d c Start debugger"
+106
View File
@@ -0,0 +1,106 @@
# Update system
sudo apt update && sudo apt upgrade -y
# Install Git, Flatpak and NFS Server
sudo apt install -y unattended-upgrades apt-listchanges etherwake git flatpak nfs-kernel-server ca-certificates curl smartmontools curl
# Configure Updates
sudo dpkg-reconfigure -plow unattended-upgrades
# Add flatpak repo
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# Install Moonlight
sudo flatpak install -y flathub com.moonlight_stream.Moonlight
# Install Jellyfin Media Player
sudo flatpak install flathub org.jellyfin.JellyfinDesktop
# Create NFS share
echo "/torrent/qbittorrent/downloads 192.168.0.4(rw,sync,no_subtree_check)
/backup/homeassistant 192.168.0.4(rw,sync,no_subtree_check)
" | sudo tee -a /etc/exports
sudo exportfs -ra
sudo systemctl enable --now nfs-kernel-server
# Show active exports
sudo exportfs -v
# Create user without password
sudo adduser media
# Add to common groups (optional)
sudo passwd -d media
# Clone and move git repo
git clone https://code.someoneslinux.selfhost.eu/lucas/Server-scripts.git
mv Server-scripts/ scripts
cd scripts
git switch -c dev origin/dev
git config pull.rebase true
git config --global user.name "Lucas $(hostname | sed 's/.*/\u&/')"
git config --global user.email lucas-f@live.at
git config --global credential.helper store
printf "https://lucas:<GET TOKEN>@code.someoneslinux.selfhost.eu\n" > ~/.git-credentials
cd
ssh-keygen -t ed25519
scp lucas@192.168.0.4:.ssh/authorized_keys ~/.ssh/authorized_keys
sudo apt install vim
vim .ssh/authorized_keys
# Add Docker's official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
rm lazygit lazygit.tar.gz
cat scripts/other/exports | sudo tee /etc/exports
echo "/dev/disk/by-uuid/98695b57-1d90-484d-9347-c886c6395050 /torrent ext4 defaults 0 1" | sudo tee /etc/fstab
sudo mkdir /torrent
sudo systemctl daemon-reload
sudo mount -a
cat scripts/other/bashrc | tee ~/.bashrc
ln -s scripts/other/bash_aliases.universal .bash_aliases
cp scripts/other/ssh_config .ssh/config
cat scripts/other/hosts | grep -v $(hostname) | sudo tee -a /etc/hosts > /dev/null
cp scripts/other/lazygit_config.yml .config/lazygit/config.yml
cp scripts/other/vimrc .vimrc
sudo mkdir -p /opt/smartctl_exporter
cd /tmp
VERSION=$(curl -s https://api.github.com/repos/prometheus-community/smartctl_exporter/releases/latest | grep tag_name | cut -d '"' -f4 | sed 's/v//')
curl -L -o smartctl_exporter.tar.gz https://github.com/prometheus-community/smartctl_exporter/releases/download/v${VERSION}/smartctl_exporter-${VERSION}.linux-amd64.tar.gz
tar -xzf smartctl_exporter.tar.gz
sudo cp smartctl_exporter-${VERSION}.linux-amd64/smartctl_exporter /opt/smartctl_exporter/smartctl_exporter
sudo chmod +x /opt/smartctl-exporter/smartctl-exporter
cd
sudo cp scripts/services/smartctl-exporter.service /etc/systemd/system/smartctl-exporter.service
sudo systemctl daemon-reload
sudo systemctl enable --now smartctl-exporter
cat scripts/other/smartd.conf | sed "/# $(hostname)/,/# $(hostname) end/ s/^# *//" smartd.conf | sudo tee /etc/smartd.conf
sudo ufw allow 9633/tcp
sudo ufw allow 111/tcp
sudo ufw allow 2049/tcp
sudo ufw allow 22/tcp
sudo ufw allow 9100/tcp
sudo ufw enable
sudo chown lucas:lucas /docker/
sudo usermod -aG docker lucas
(crontab -l 2>/dev/null; echo "*/5 * * * * /home/lucas/scripts/network/node-exporter-update-public-ip.sh") | crontab -
(sudo crontab -l 2>/dev/null; echo "*/5 * * * * /home/lucas/scripts/network/node-exporter-smartmon.sh") | sudo crontab -
sudo -u lucas sg docker -c '
for d in /docker/*; do
if [ -d "$d" ] && [ -f "$d/docker-compose.yaml" ]; then
docker compose -f "$d/docker-compose.yaml" up -d
fi
done
'
+23
View File
@@ -0,0 +1,23 @@
os:
#edit: "/usr/bin/subl" # or "vim", "code", "nano", etc.
edit: "vim {{filename}}"
editAtLine: "vim +{{line}} {{filename}}"
gui:
mouseEvents: false
customCommands:
- key: <c-r>
context: "localBranches"
description: "Rebase current branch onto selected branch using theirs"
prompts:
- type: "confirm"
title: "Confirm rebase"
body: "Rebase current branch onto '{{.SelectedLocalBranch.Name}}' using -X theirs?\nThis will prefer THEIR changes on conflicts."
command: "git rebase {{.SelectedLocalBranch.Name}} -X theirs"
keybinding:
universal:
# Set tabs to arrow keys
nextTab: '<right>'
prevTab: '<left>'
# Move panel navigation to H and L
nextBlock: 'l'
prevBlock: 'h'
+83
View File
@@ -0,0 +1,83 @@
## /etc/smartd.conf
# ============================================================================
# Common options:
#
# -a Enable all standard SMART monitoring:
# * SMART health status
# * Error logs
# * Self-test logs
# * Attribute monitoring
#
# -o on Enable automatic offline data collection
#
# -S on Enable SMART attribute autosave
#
# -s (...) Schedule SMART self-tests
#
# Test schedule syntax:
# S = Short self-test
# L = Long/Extended self-test
#
# Fields:
# (TYPE/MM/DD/DW/HH)
#
# MM = month (01-12 or .. for every month)
# DD = day of month (01-31 or .. for every day)
# DW = day of week (1-7, where 7=Sunday)
# HH = hour (00-23)
#
# Schedule used below:
# S/../../7/02
# → Run SHORT test every Sunday at 02:00
#
# L/../01/./03
# → Run LONG test on the 1st day of every month at 03:00
#
## serverhost
#
# # WD Red 3 TB Backup Drive
#/dev/sda -a -o on -S on -s (S/../../7/02|L/../01/./03)
# Samsung/Seagate 2 TB Laptop Drive
# /dev/sdb -a -o on -S on -s (S/../../7/02|L/../01/./03)
## serverhost end
## mediahost
#
## WD Gold 16 TB
#/dev/sda -a -o on -S on -s (S/../../7/02|L/../01/./03)
#
## WD Red Pro 16 TB
#/dev/sdb -a -o on -S on -s (S/../../7/02|L/../01/./03)
#
## WD Red Pro 16 TB
#/dev/sdc -a -o on -S on -s (S/../../7/02|L/../01/./03)
#
## Seagate Exos 8 TB
#/dev/sdd -a -o on -S on -s (S/../../7/02|L/../01/./03)
#
## WD Blue SN5100 NVMe
## NVMe drives support SMART differently, so -o and -S are not needed.
#/dev/nvme0n1 -a -s (S/../../7/02|L/../01/./03)
#
## mediahost end
#
## quiethost
#
## Seagate IronWolf 8TB
## /dev/sda
#/dev/sda -a -o on -S on -s (S/../../7/02|L/../01/./03)
#
## Intenso 250GB NVMe
## /dev/nvme0n1
## NVMe devices do not use ATA offline data collection,
## therefore -o on and -S on are omitted.
#/dev/nvme0n1 -a -s (S/../../7/02|L/../01/./03)
#
## Crucial P1 1TB NVMe
## /dev/nvme1n1
#/dev/nvme1n1 -a -s (S/../../7/02|L/../01/./03)#
#
## quiethost end
+15
View File
@@ -0,0 +1,15 @@
Host serverhost
HostName someoneslinux.ddns.net
User lucas
Host raspberry
HostName raspberry
User lucas
Host quiethost
HostName quiethost
User lucas
Host mediahost
HostName mediahost
User lucas
+5
View File
@@ -0,0 +1,5 @@
set mouse=
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab