This commit is contained in:
2023-08-11 11:47:26 -05:00
parent 2c94c4d0dd
commit 0be32d752f
48 changed files with 590 additions and 109 deletions

View File

@@ -0,0 +1,37 @@
#!/bin/bash
# ask to set static ip address
read -r -p "Set Static IP address? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
read -r -p "Enter Static IP Address with subnet prefix: " staticip
read -r -p "Enter Gateway IP Address: " gatewayip
read -r -p "Enter Primary DNS IP Address: " dnsip1
# get adapter name
name=$(basename /sys/class/net/e*)
# backup original interfaces file
if [[ ! -f /etc/network/interfaces.bak ]] ; then
cp /etc/network/interfaces /etc/network/interfaces.bak
fi
rm /etc/network/interfaces
cp /etc/network/interfaces.bak /etc/network/interfaces
# set static ip
sed -i "s,^iface $name inet dhcp*,iface $name inet static," /etc/network/interfaces
echo " address $staticip" >> /etc/network/interfaces
echo " gateway $gatewayip" >> /etc/network/interfaces
# backup resolv.conf file
if [[ ! -f /etc/resolv.conf.bak ]] ; then
cp /etc/resolv.conf /etc/resolv.conf.bak
fi
rm /etc/resolv.conf
# set primary dns ip
echo "nameserver $dnsip1" >> /etc/resolv.conf
# ask for secondary dns ip
read -r -p "Set Secondary DNS IP Address? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
read -r -p "Enter Secondary DNS IP Address: " dnsip2
echo "nameserver $dnsip2" >> /etc/resolv.conf
fi
# restart the interface
ifdown $name
ifup $name
fi

View File

@@ -0,0 +1,22 @@
# ask to install docker
if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then
read -r -p "Install Docker? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
# prepare for install
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -p /home/akanealw/docker/appdata
chown -R akanealw:akanealw /home/akanealw/docker
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# install docker
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# post install
groupadd docker > /dev/null 2>&1
usermod -aG docker akanealw
systemctl enable docker.service
systemctl enable containerd.service
fi
fi

View File

@@ -0,0 +1,248 @@
#!/bin/bash
# autoreply config update dialog with no
if [[ ! -f /etc/apt/apt.conf.d/local ]] ; then
echo "Dpkg::Options {" >> /etc/apt/apt.conf.d/local
echo " "--force-confdef";" >> /etc/apt/apt.conf.d/local
echo " "--force-confold";" >> /etc/apt/apt.conf.d/local
echo "}" >> /etc/apt/apt.conf.d/local
fi
# update bookworm to new debian.sources file
if [[ -f /etc/apt/sources.list ]] ; then
isInFile=$(cat /etc/apt/sources.list | grep -c "bullseye")
if [ $isInFile -eq 0 ]; then
mkdir /etc/apt/mirrors > /dev/null 2>&1
echo "https://deb.debian.org/debian" >> /etc/apt/mirrors/debian.list
echo "https://deb.debian.org/debian-security" >> /etc/apt/mirrors/debian-security.list
echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources
echo "URIs: mirror+file:///etc/apt/mirrors/debian.list" >> /etc/apt/sources.list.d/debian.sources
echo "Suites: bookworm bookworm-updates bookworm-backports" >> /etc/apt/sources.list.d/debian.sources
echo "Components: main contrib non-free non-free-firmware" >> /etc/apt/sources.list.d/debian.sources
echo "" >> /etc/apt/sources.list.d/debian.sources
echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources
echo "URIs: mirror+file:///etc/apt/mirrors/debian-security.list" >> /etc/apt/sources.list.d/debian.sources
echo "Suites: bookworm-security" >> /etc/apt/sources.list.d/debian.sources
echo "Components: main" >> /etc/apt/sources.list.d/debian.sources
mv /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1
rm /etc/apt/sources.list.11.backup > /dev/null 2>&1
fi
fi
# update and upgrade
apt-get update
apt-get upgrade -y
# download and install packages
apt-get install -y lsb-release cron qemu-guest-agent sudo nano curl wget zip unzip git rsync man-db cifs-utils nfs-common parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
# add akanealw user if not existing
isInFile=$(cat /etc/passwd | grep -c "akanealw")
if [ $isInFile -eq 0 ]; then
echo "Set password for akanealw"
useradd -m -p $(openssl passwd -1 ${PASSWORD}) -s /bin/bash -d /home/akanealw akanealw
mkdir /home/akanealw/.ssh
chown akanealw:akanealw /home/akanealw/.ssh
chmod 700 /home/akanealw/.ssh
cp /root/.ssh/authorized_keys /home/akanealw/.ssh > /dev/null 2>&1
chown akanealw:akanealw /home/akanealw/.ssh/authorized_keys > /dev/null 2>&1
chmod 600 /home/akanealw/.ssh/authorized_keys > /dev/null 2>&1
fi
# create akanealw file in /etc/sudoers.d
if [[ ! -f /etc/sudoers.d/akanealw ]] ; then
echo "akanealw ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/akanealw
fi
# enable ping for all users
setcap 'cap_net_admin,cap_net_raw+ep' $(which ping)
# remove all motd
rm /etc/motd > /dev/null 2>&1
# disable systemd-networkd-wait-online.service
systemctl disable systemd-networkd-wait-online.service
# git config
git config --global credential.helper store
git config --global user.name "akanealw"
git config --global user.email "akanealw@gmail.com"
git config --global init.defaultBranch main
# show ip in /etc/issue
name=$(basename /sys/class/net/e*)
isInFile=$(cat /etc/issue | grep -c "$name")
if [ $isInFile -eq 0 ]; then
cp /etc/issue /etc/issue.bak
echo "$name: \4{$name}" >> /etc/issue
echo "" >> /etc/issue
fi
# set input preferences
if [[ ! -f /etc/inputrc.bak ]] ; then
cp /etc/inputrc /etc/inputrc.bak > /dev/null 2>&1
fi
rm /etc/inputrc > /dev/null 2>&1
cp /etc/inputrc.bak /etc/inputrc
echo "" >> /etc/inputrc
echo "set completion-ignore-case On" >> /etc/inputrc
# set bash preferences and aliases
if [[ -f /etc/bash.bashrc.default ]] ; then
mv /etc/bash.bashrc.default /etc/bash.bashrc.bak > /dev/null 2>&1
fi
if [[ ! -f /etc/bash.bashrc.bak ]] ; then
cp /etc/bash.bashrc /etc/bash.bashrc.bak > /dev/null 2>&1
fi
rm /etc/bash.bashrc > /dev/null 2>&1
cp /etc/bash.bashrc.bak /etc/bash.bashrc
echo "" >> /etc/bash.bashrc
echo "# custom settings and aliases" >> /etc/bash.bashrc
echo "set -o noclobber" >> /etc/bash.bashrc
echo "alias lsa='ls -alhvF'" >> /etc/bash.bashrc
echo "alias systart='sudo systemctl start'" >> /etc/bash.bashrc
echo "alias systop='sudo systemctl stop'" >> /etc/bash.bashrc
echo "alias sysrest='sudo systemctl restart'" >> /etc/bash.bashrc
echo "alias systat='sudo systemctl status'" >> /etc/bash.bashrc
echo "alias aptupy='sudo apt update && sudo apt upgrade -y'" >> /etc/bash.bashrc
echo "alias aptiy='sudo apt install -y'" >> /etc/bash.bashrc
echo "alias aptry='sudo apt remove -y'" >> /etc/bash.bashrc
echo "alias aptrpy='sudo apt remove --purge -y'" >> /etc/bash.bashrc
echo "alias aptary='sudo apt autoremove -y'" >> /etc/bash.bashrc
echo "alias apts='sudo apt search'" >> /etc/bash.bashrc
echo "alias aptl='sudo apt list --installed'" >> /etc/bash.bashrc
echo "alias aptsh='sudo apt show'" >> /etc/bash.bashrc
echo "alias aptac='sudo apt-get autoclean'" >> /etc/bash.bashrc
echo "alias dpkgi='sudo dpkg -i'" >> /etc/bash.bashrc
echo "alias tmxls='tmux ls'" >> /etc/bash.bashrc
echo "alias tmxa='tmux attach -t'" >> /etc/bash.bashrc
echo "alias dc='docker compose'" >> /etc/bash.bashrc
echo "alias dcup='docker compose up -d'" >> /etc/bash.bashrc
echo "alias dcaup='docker compose -f admin-compose.yml up -d'" >> /etc/bash.bashrc
echo "alias dcdown='docker compose down'" >> /etc/bash.bashrc
echo "alias dcadown='docker compose -f admin-compose.yml down'" >> /etc/bash.bashrc
echo "alias dcpull='docker compose pull'" >> /etc/bash.bashrc
echo "alias dcapull='docker compose -f admin-compose.yml pull'" >> /etc/bash.bashrc
echo "alias dps='docker ps'" >> /etc/bash.bashrc
echo "alias dipaf='docker image prune -a -f'" >> /etc/bash.bashrc
# create tmux config
rm /etc/tmux.conf* > /dev/null 2>&1
echo "unbind C-b" >> /etc/tmux.conf
echo "set-option -g prefix C-a" >> /etc/tmux.conf
echo "bind-key C-a send-prefix" >> /etc/tmux.conf
# create credentials and map network drives
isInFile=$(cat /etc/fstab | grep -c "192.168.1.41")
if [ $isInFile -eq 0 ]; then
mkdir /mnt/truenasdata > /dev/null 2>&1
chown akanealw:akanealw /mnt/truenasdata
echo "# nfs shares" >> /etc/fstab
echo "192.168.1.41:/mnt/data /mnt/truenasdata nfs defaults,nolock,soft,vers=4.2 0 0" >> /etc/fstab
fi
# ask to install samba
if [[ ! -f /etc/samba/smb.conf ]] ; then
read -r -p "Install Samba? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
apt-get install -y samba --no-install-recommends
# configure default samba share
(echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw
sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf
isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]")
if [ $isInFile -eq 0 ]; then
echo "[akanealw]" >> /etc/samba/smb.conf
echo " comment = akanealw" >> /etc/samba/smb.conf
echo " read only = no" >> /etc/samba/smb.conf
echo " path = /home/akanealw" >> /etc/samba/smb.conf
echo " guest ok = no" >> /etc/samba/smb.conf
echo "" >> /etc/samba/smb.conf
fi
fi
fi
# ask to install docker
if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then
read -r -p "Install Docker? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
# prepare for install
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -p /home/akanealw/docker/appdata
chown -R akanealw:akanealw /home/akanealw/docker
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# install docker
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# post install
groupadd docker > /dev/null 2>&1
usermod -aG docker akanealw
systemctl enable docker.service
systemctl enable containerd.service
fi
fi
# ask to regenerate machine-id
if [[ ! -f /etc/machine-id-regenerated ]] ; then
read -r -p "Regenerate machine-id? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
# regenerate machine-id
rm -f /etc/machine-id /var/lib/dbus/machine-id
dbus-uuidgen --ensure=/etc/machine-id
dbus-uuidgen --ensure
touch /etc/machine-id-regenerated
fi
fi
# ask to regenerate ssh host keys
if [[ ! -d /etc/cloud ]] ; then
if [[ ! -f /home/akanealw/.ssh/ssh_keys_regenerated ]] ; then
read -r -p "Regenerate SSH Keys? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
mkdir /home/akanealw/.ssh
touch /home/akanealw/.ssh/ssh_keys_regenerated
chmod 700 /home/akanealw/.ssh
chown -R akanealw:akanealw /home/akanealw/.ssh
fi
fi
fi
# ask to set static ip address
if [[ ! -d /etc/cloud ]] ; then
if [[ ! -f /etc/network/interfaces.bak ]] ; then
read -r -p "Set Static IP address? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
read -r -p "Enter Static IP Address with subnet prefix: " staticip
read -r -p "Enter Gateway IP Address: " gatewayip
read -r -p "Enter Primary DNS IP Address: " dnsip1
read -r -p "Enter Secondary DNS IP Address: " dnsip2
# get adapter name
name=$(basename /sys/class/net/e*)
# backup original interfaces file
if [[ ! -f /etc/network/interfaces.bak ]] ; then
cp /etc/network/interfaces /etc/network/interfaces.bak
fi
rm /etc/network/interfaces
cp /etc/network/interfaces.bak /etc/network/interfaces
# set static ip
sed -i "s,^iface $name inet dhcp*,iface $name inet static," /etc/network/interfaces
echo " address $staticip" >> /etc/network/interfaces
echo " gateway $gatewayip" >> /etc/network/interfaces
# backup resolv.conf file
if [[ ! -f /etc/resolv.conf.bak ]] ; then
cp /etc/resolv.conf /etc/resolv.conf.bak
fi
rm /etc/resolv.conf
# set primary dns ip
echo "nameserver $dnsip1" >> /etc/resolv.conf
echo "nameserver $dnsip2" >> /etc/resolv.conf
# restart the interface
ifdown $name
ifup $name
fi
fi
fi

View File

@@ -0,0 +1,17 @@
# install and configure default share
apt-get update
apt-get install -y samba --no-install-recommends
(echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw
sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf
isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]")
if [ $isInFile -eq 0 ]; then
echo "[akanealw]" >> /etc/samba/smb.conf
echo " comment = akanealw" >> /etc/samba/smb.conf
echo " read only = no" >> /etc/samba/smb.conf
echo " path = /home/akanealw" >> /etc/samba/smb.conf
echo " guest ok = no" >> /etc/samba/smb.conf
echo "" >> /etc/samba/smb.conf
fi
# restart samba
systemctl restart smbd

View File

@@ -0,0 +1,21 @@
#!/bin/bash
if [[ -f /etc/apt/sources.list ]] ; then
isInFile=$(cat /etc/apt/sources.list | grep -c "bullseye")
if [ $isInFile -eq 0 ]; then
mkdir /etc/apt/mirrors > /dev/null 2>&1
echo "https://deb.debian.org/debian" >> /etc/apt/mirrors/debian.list
echo "https://deb.debian.org/debian-security" >> /etc/apt/mirrors/debian-security.list
echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources
echo "URIs: mirror+file:///etc/apt/mirrors/debian.list" >> /etc/apt/sources.list.d/debian.sources
echo "Suites: bookworm bookworm-updates bookworm-backports" >> /etc/apt/sources.list.d/debian.sources
echo "Components: main contrib non-free non-free-firmware" >> /etc/apt/sources.list.d/debian.sources
echo "" >> /etc/apt/sources.list.d/debian.sources
echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources
echo "URIs: mirror+file:///etc/apt/mirrors/debian-security.list" >> /etc/apt/sources.list.d/debian.sources
echo "Suites: bookworm-security" >> /etc/apt/sources.list.d/debian.sources
echo "Components: main" >> /etc/apt/sources.list.d/debian.sources
mv /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1
rm /etc/apt/sources.list.11.backup > /dev/null 2>&1
fi
fi

View File

@@ -0,0 +1,6 @@
#!/bin/bash
rm /home/akanealw/scripts/debian-essentials* > /dev/null 2>&1
mkdir /home/akanealw/scripts > /dev/null 2>&1
wget -O /home/akanealw/scripts/debian-essentials.sh https://aknlw.com/debian-essentials
chmod +x /home/akanealw/scripts/debian-essentials.sh
sudo /home/akanealw/scripts/debian-essentials.sh

View File

@@ -0,0 +1,33 @@
#!/bin/bash
# set nanorc keybinds
if [[ -f /etc/nanorc.default ]] ; then
mv /etc/nanorc.default /etc/nanorc.bak > /dev/null 2>&1
fi
if [[ ! -f /etc/nanorc.bak ]] ; then
cp /etc/nanorc /etc/nanorc.bak > /dev/null 2>&1
fi
rm /etc/nanorc > /dev/null 2>&1
cp /etc/nanorc.bak /etc/nanorc
echo "" >> /etc/nanorc
echo "# custom binds" >> /etc/nanorc
echo "bind ^X exit all" >> /etc/nanorc
echo "bind ^S savefile main" >> /etc/nanorc
echo "bind ^O writeout main" >> /etc/nanorc
echo "bind ^I insert main" >> /etc/nanorc
echo "bind ^F whereis all" >> /etc/nanorc
echo "bind ^G findnext all" >> /etc/nanorc
echo "bind ^B wherewas all" >> /etc/nanorc
echo "bind ^D findprevious all" >> /etc/nanorc
echo "bind ^R replace main" >> /etc/nanorc
echo "bind ^K cut all" >> /etc/nanorc
echo "bind ^C copy main" >> /etc/nanorc
echo "bind ^V paste all" >> /etc/nanorc
echo "bind ^A mark main" >> /etc/nanorc
echo "bind ^T gotoline main" >> /etc/nanorc
echo "bind ^T gotodir browser" >> /etc/nanorc
echo "unbind ^U all" >> /etc/nanorc
echo "unbind ^N main" >> /etc/nanorc
echo "unbind ^Y all" >> /etc/nanorc
echo "unbind M-J main" >> /etc/nanorc
echo "unbind M-T main" >> /etc/nanorc

View File

@@ -0,0 +1,15 @@
#!/bin/bash
isInFile=$(cat /etc/os-release | grep -c "ID=debian")
if [ $isInFile -eq 1 ]; then
curl -O http://192.168.1.50/debian/debian-essentials.sh
chmod +x debian-essentials.sh
sudo ./debian-essentials.sh
fi
isInFile=$(cat /etc/os-release | grep -c "ID=ubuntu")
if [ $isInFile -eq 1 ]; then
curl -O http://192.168.1.50/ubuntu/ubuntu-essentials.sh
chmod +x ubuntu-essentials.sh
sudo ./ubuntu-essentials.sh
fi

View File

@@ -0,0 +1,9 @@
#!/bin/bash
rsync -azvP -e "ssh -i ~/.ssh/awsvps" --progress \
--include=/ \
--include=/etc/ \
--include=/etc/iptables/*** \
--include=/etc/wireguard/*** \
--exclude=* \
root@10.8.0.12:/ /mnt/backups/awsvpsbackups/$(/bin/date +%Y-%m-%d-%I-%M-%S-%p)

View File

@@ -0,0 +1,18 @@
#!/bin/bash
rsync -azvP -e "ssh -i ~/.ssh/truenas" --progress \
--include=/ \
--include=/home/*** \
--include=/etc \
--include=/etc/fstab \
--include=/etc/default/*** \
--include=/etc/dnsmasq.d/*** \
--include=/etc/forgejo/*** \
--include=/etc/nginx/*** \
--include=/etc/wireguard/*** \
--include=/srv/*** \
--include=/var \
--include=/var/lib \
--include=/var/lib/forgejo/*** \
--exclude=* \
/ akanealw@192.168.1.41:/mnt/data/backups/fileserverbackup/$(/bin/date +%Y-%m-%d-%I-%M-%S-%p)

View File

@@ -0,0 +1,4 @@
git config --global credential.helper store
git config --global user.name "akanealw"
git config --global user.email "akanealw@gmail.com"
git config --global init.defaultBranch main

60
files/bashscripts/joinad.sh Executable file
View File

@@ -0,0 +1,60 @@
apt update
apt -y install realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit
#Say no to WINS via DNS
realm discover ad.akanealw.com
realm join -U nwettstein ad.akanealw.com
realm list
bash -c "cat > /usr/share/pam-configs/mkhomedir" <<EOF
Name: activate mkhomedir
Default: yes
Priority: 900
Session-Type: Additional
Session:
required pam_mkhomedir.so umask=0022 skel=/etc/skel
EOF
pam-auth-update
#Enable mkhomedir
nano /etc/sssd/sssd.conf
#Change two lines
use_fully_qualified_names = False
fallback_homedir = /home/%u
realm permit -g DebianLogin
realm list
nano /etc/sudoers.d/domain_admins
#Insert three lines
%Domain\ Admins@ad.akanealw.com ALL=(ALL) ALL
nwettstein@ad.akanealw.com ALL=(ALL) ALL
nwettstein ALL=(ALL) NOPASSWD:ALL
systemctl restart sssd
systemctl status sssd
systemctl restart sshd
systemctl status sshd
exit
relog as nwettstein
groups
#Add nwettstein to necessary groups
usermod -a -G docker nwettstein
usermod -a -G www-data nwettstein
#Disable root account
passwd -l root
passwd -S root

View File

@@ -0,0 +1,4 @@
#!/bin/bash
find "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/PhotoTranscoder" -name "*.jpg" -type f -mtime +5 -delete
find "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/PhotoTranscoder" -name "*.ppm" -type f -mtime +5 -delete

View File

@@ -0,0 +1,90 @@
#!/bin/bash
# remove old images
rm *.raw > /dev/null 2>&1
rm *.qcow2 > /dev/null 2>&1
rm *.tar.xz > /dev/null 2>&1
# debian 11 bullseye cloud
wget -q -O debian-11-genericcloud-amd64-daily.tar.xz https://cloud.debian.org/images/cloud/bullseye/daily/latest/debian-11-genericcloud-amd64-daily.tar.xz
tar --transform='s/disk/debian-11-genericcloud-amd64-daily/g' -xvf debian-11-genericcloud-amd64-daily.tar.xz
#rm debian-11-genericcloud-amd64-daily.tar.xz
#mv disk.raw debian-11-genericcloud-amd64-daily.raw
/usr/sbin/qm set 301 --delete scsi0
sleep 2
/usr/sbin/qm set 301 --delete unused0
sleep 2
/usr/sbin/qm set 301 --scsi0 local-zfs:0,import-from=/root/scripts/debian-11-genericcloud-amd64-daily.raw,discard=on,ssd=1
sleep 2
/usr/sbin/qm set 301 --boot order=scsi0
sleep 2
/usr/sbin/qm cloudinit update 301
sleep 2
# debian 12 bookworm cloud
wget -q -O debian-12-genericcloud-amd64-daily.tar.xz https://cloud.debian.org/images/cloud/bookworm/daily/latest/debian-12-generic-amd64-daily.tar.xz
tar --transform='s/disk/debian-12-genericcloud-amd64-daily/g' -xvf debian-12-genericcloud-amd64-daily.tar.xz
#rm debian-11-genericcloud-amd64-daily.tar.xz
#mv disk.raw debian-11-genericcloud-amd64-daily.raw
/usr/sbin/qm set 302 --delete scsi0
sleep 2
/usr/sbin/qm set 302 --delete unused0
sleep 2
/usr/sbin/qm set 302 --scsi0 local-zfs:0,import-from=/root/scripts/debian-12-genericcloud-amd64-daily.raw,discard=on,ssd=1
sleep 2
/usr/sbin/qm set 302 --boot order=scsi0
sleep 2
/usr/sbin/qm cloudinit update 302
sleep 2
# ubuntu focal 20.04
wget -q -O focal-server-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
/usr/sbin/qm set 310 --delete scsi0
sleep 2
/usr/sbin/qm set 310 --delete unused0
sleep 2
/usr/sbin/qm set 310 --scsi0 local-zfs:0,import-from=/root/scripts/focal-server-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 2
/usr/sbin/qm set 310 --boot order=scsi0
sleep 2
/usr/sbin/qm cloudinit update 310
sleep 2
# ubuntu jammy 22.04
wget -q -O jammy-server-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
/usr/sbin/qm set 311 --delete scsi0
sleep 2
/usr/sbin/qm set 311 --delete unused0
sleep 2
/usr/sbin/qm set 311 --scsi0 local-zfs:0,import-from=/root/scripts/jammy-server-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 2
/usr/sbin/qm set 311 --boot order=scsi0
sleep 2
/usr/sbin/qm cloudinit update 311
sleep 2
# ubuntu focal 20.04 minimal
wget -q -O ubuntu-20.04-minimal-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img
/usr/sbin/qm set 312 --delete scsi0
sleep 2
/usr/sbin/qm set 312 --delete unused0
sleep 2
/usr/sbin/qm set 312 --scsi0 local-zfs:0,import-from=/root/scripts/ubuntu-20.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 2
/usr/sbin/qm set 312 --boot order=scsi0
sleep 2
/usr/sbin/qm cloudinit update 312
sleep 2
# ubuntu jammy 22.04 minimal
wget -q -O ubuntu-22.04-minimal-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
/usr/sbin/qm set 313 --delete scsi0
sleep 2
/usr/sbin/qm set 313 --delete unused0
sleep 2
/usr/sbin/qm set 313 --scsi0 local-zfs:0,import-from=/root/scripts/ubuntu-22.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 2
/usr/sbin/qm set 313 --boot order=scsi0
sleep 2
/usr/sbin/qm cloudinit update 313
sleep 2

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# remove older scripts
rm /root/proxmox-* > /dev/null 2>&1
rm /root/scripts/proxmox-* > /dev/null 2>&1
# check for pbs directory
if [[ -d /etc/proxmox-backup ]] ; then
wget -O /root/scripts/proxmox-pbs-essentials.sh https://aknlw.com/proxmox-pbs-essentials
wget -O /root/scripts/proxmox-post-pbs-install.sh https://aknlw.com/proxmox-post-pbs-install
wget -O /root/scripts/proxmox-kernel-clean.sh https://aknlw.com/proxmox-kernel-clean
chmod +x /root/scripts/proxmox-*.sh
fi
# check for pve directory
if [[ -d /etc/pve ]] ; then
wget -O /root/scripts/proxmox-pve-essentials.sh https://aknlw.com/proxmox-pve-essentials
wget -O /root/scripts/proxmox-post-pve-install.sh https://aknlw.com/proxmox-post-pve-install
wget -O /root/scripts/proxmox-kernel-clean.sh https://aknlw.com/proxmox-kernel-clean
chmod +x /root/scripts/proxmox-*.sh
fi

View File

@@ -0,0 +1,67 @@
#!/bin/bash
# autoreply config update dialog with no
if [[ ! -f /etc/apt/apt.conf.d/local ]] ; then
echo "Dpkg::Options {" >> /etc/apt/apt.conf.d/local
echo " "--force-confdef";" >> /etc/apt/apt.conf.d/local
echo " "--force-confold";" >> /etc/apt/apt.conf.d/local
echo "}" >> /etc/apt/apt.conf.d/local
fi
# update and upgrade
apt-get update
apt-get upgrade -y
# download and install packages
apt-get install -y sudo curl wget zip unzip git man-db cifs-utils nfs-common ntfs-3g parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
# set input preferences
if [[ ! -f /etc/inputrc.bak ]] ; then
cp /etc/inputrc /etc/inputrc.bak > /dev/null 2>&1
fi
rm /etc/inputrc > /dev/null 2>&1
cp /etc/inputrc.bak /etc/inputrc
echo "" >> /etc/inputrc
echo "set completion-ignore-case On" >> /etc/inputrc
# set bash preferences and aliases
if [[ -f /etc/bash.bashrc.default ]] ; then
mv /etc/bash.bashrc.default /etc/bash.bashrc.bak > /dev/null 2>&1
fi
if [[ ! -f /etc/bash.bashrc.bak ]] ; then
cp /etc/bash.bashrc /etc/bash.bashrc.bak > /dev/null 2>&1
fi
rm /etc/bash.bashrc > /dev/null 2>&1
cp /etc/bash.bashrc.bak /etc/bash.bashrc
echo "" >> /etc/bash.bashrc
echo "# custom settings and aliases" >> /etc/bash.bashrc
echo "set -o noclobber" >> /etc/bash.bashrc
echo "alias lsa='ls -alhvF'" >> /etc/bash.bashrc
echo "alias systart='systemctl start'" >> /etc/bash.bashrc
echo "alias systop='ssystemctl stop'" >> /etc/bash.bashrc
echo "alias sysrest='systemctl restart'" >> /etc/bash.bashrc
echo "alias systat='systemctl status'" >> /etc/bash.bashrc
echo "alias aptupy='apt update && sudo apt upgrade -y'" >> /etc/bash.bashrc
echo "alias aptiy='apt install -y'" >> /etc/bash.bashrc
echo "alias aptry='apt remove -y'" >> /etc/bash.bashrc
echo "alias aptrpy='apt remove --purge -y'" >> /etc/bash.bashrc
echo "alias aptary='apt autoremove -y'" >> /etc/bash.bashrc
echo "alias apts='apt search'" >> /etc/bash.bashrc
echo "alias aptl='apt list --installed'" >> /etc/bash.bashrc
echo "alias aptsh='apt show'" >> /etc/bash.bashrc
echo "alias aptac='apt-get autoclean'" >> /etc/bash.bashrc
echo "alias dpkgi='dpkg -i'" >> /etc/bash.bashrc
echo "alias tmxls='tmux ls'" >> /etc/bash.bashrc
echo "alias tmxa='tmux attach -t'" >> /etc/bash.bashrc
# create tmux config
rm /etc/tmux.conf* > /dev/null 2>&1
echo "unbind C-b" >> /etc/tmux.conf
echo "set-option -g prefix C-a" >> /etc/tmux.conf
echo "bind-key C-a send-prefix" >> /etc/tmux.conf
# git config
git config --global credential.helper store
git config --global user.name "akanealw"
git config --global user.email "akanealw@gmail.com"
git config --global init.defaultBranch main

View File

@@ -0,0 +1,73 @@
#!/bin/bash
# autoreply config update dialog with no
if [[ ! -f /etc/apt/apt.conf.d/local ]] ; then
echo "Dpkg::Options {" >> /etc/apt/apt.conf.d/local
echo " "--force-confdef";" >> /etc/apt/apt.conf.d/local
echo " "--force-confold";" >> /etc/apt/apt.conf.d/local
echo "}" >> /etc/apt/apt.conf.d/local
fi
# update and upgrade
apt-get update
apt-get upgrade -y
# download and install packages
apt-get install -y sudo curl wget zip unzip git man-db cifs-utils nfs-common ntfs-3g parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
# update templates
pveam update
# remove all motd
rm /etc/motd > /dev/null 2>&1
# set input preferences
if [[ ! -f /etc/inputrc.bak ]] ; then
cp /etc/inputrc /etc/inputrc.bak > /dev/null 2>&1
fi
rm /etc/inputrc > /dev/null 2>&1
cp /etc/inputrc.bak /etc/inputrc
echo "" >> /etc/inputrc
echo "set completion-ignore-case On" >> /etc/inputrc
# set bash preferences and aliases
if [[ -f /etc/bash.bashrc.default ]] ; then
mv /etc/bash.bashrc.default /etc/bash.bashrc.bak > /dev/null 2>&1
fi
if [[ ! -f /etc/bash.bashrc.bak ]] ; then
cp /etc/bash.bashrc /etc/bash.bashrc.bak > /dev/null 2>&1
fi
rm /etc/bash.bashrc > /dev/null 2>&1
cp /etc/bash.bashrc.bak /etc/bash.bashrc
echo "" >> /etc/bash.bashrc
echo "# custom settings and aliases" >> /etc/bash.bashrc
echo "set -o noclobber" >> /etc/bash.bashrc
echo "alias lsa='ls -alhvF'" >> /etc/bash.bashrc
echo "alias systart='sudo systemctl start'" >> /etc/bash.bashrc
echo "alias systop='sudo systemctl stop'" >> /etc/bash.bashrc
echo "alias sysrest='sudo systemctl restart'" >> /etc/bash.bashrc
echo "alias systat='sudo systemctl status'" >> /etc/bash.bashrc
echo "alias aptupy='sudo apt update && sudo apt upgrade -y'" >> /etc/bash.bashrc
echo "alias aptiy='sudo apt install -y'" >> /etc/bash.bashrc
echo "alias aptry='sudo apt remove -y'" >> /etc/bash.bashrc
echo "alias aptrpy='sudo apt remove --purge -y'" >> /etc/bash.bashrc
echo "alias aptary='sudo apt autoremove -y'" >> /etc/bash.bashrc
echo "alias apts='sudo apt search'" >> /etc/bash.bashrc
echo "alias aptl='sudo apt list --installed'" >> /etc/bash.bashrc
echo "alias aptsh='sudo apt show'" >> /etc/bash.bashrc
echo "alias aptac='sudo apt-get autoclean'" >> /etc/bash.bashrc
echo "alias dpkgi='sudo dpkg -i'" >> /etc/bash.bashrc
echo "alias tmxls='tmux ls'" >> /etc/bash.bashrc
echo "alias tmxa='tmux attach -t'" >> /etc/bash.bashrc
# create tmux config
rm /etc/tmux.conf* > /dev/null 2>&1
echo "unbind C-b" >> /etc/tmux.conf
echo "set-option -g prefix C-a" >> /etc/tmux.conf
echo "bind-key C-a send-prefix" >> /etc/tmux.conf
# git config
git config --global credential.helper store
git config --global user.name "akanealw"
git config --global user.email "akanealw@gmail.com"
git config --global init.defaultBranch main

View File

@@ -0,0 +1,3 @@
ssh -i /root/.ssh/gamingpc akanealw@gamingpc -t 'shutdown /f /t 3'
ssh -i /root/.ssh/truenas root@truenas -t 'shutdown -p now'
shutdown -h now

View File

@@ -0,0 +1 @@
qm importdisk VM# IMAGENAME.raw vdisks

View File

@@ -0,0 +1,19 @@
PVE=/usr/share/pve-manager/js/pvemanagerlib.js
LIB=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
PBS=/usr/share/javascript/proxmox-backup/js/proxmox-backup-gui.js
if [ -f $PVE ]; then
# hide pve gui help/documentation button
sed -i.bak "s/hidden: false/hidden: true/g" $PVE
# fix proxmox widget toolkit lib
sed -i.bak -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" $LIB
systemctl restart pveproxy
fi
if [ -f $PBS ]; then
# fix proxmox widget toolkit lib
sed -i.bak -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" $LIB
# fix pbs gui
sed -i.bak "s/let subStatus = status.toLowerCase() === 'active' ? 2 : 0/let subStatus = status.toLowerCase() === 'active' ? 2 : 2/" $PBS
systemctl restart proxmox-backup-proxy
fi

View File

@@ -0,0 +1 @@
qemu-img convert -p -f vhdx /mnt/ntfsro/VirtualMachines/Backups/HPV-02-.vhdx -O raw /rpool/data/rawimports/.raw

View File

@@ -0,0 +1,47 @@
#!/bin/bash
cd /root/cloud-images
# remove old images
rm * > /dev/null 2>&1
# debian 12 bookworm cloud
wget -q https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.tar.xz
tar -xvf debian-12-genericcloud-amd64.tar.xz
mv disk.raw debian-12-generic-amd64.raw
/usr/sbin/qm set 303 --delete scsi0
sleep 3
/usr/sbin/qm set 303 --delete unused0
sleep 3
/usr/sbin/qm set 303 --scsi0 local-zfs:0,import-from=/root/cloud-images/debian-12-generic-amd64.raw,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 303 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 303
sleep 3
# ubuntu jammy 22.04
wget -q -O ubuntu-22.04-server-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
/usr/sbin/qm set 314 --delete scsi0
sleep 3
/usr/sbin/qm set 314 --delete unused0
sleep 3
/usr/sbin/qm set 314 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-server-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 314 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 314
sleep 3
# ubuntu jammy 22.04 minimal
wget -q -O ubuntu-22.04-minimal-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
/usr/sbin/qm set 315 --delete scsi0
sleep 3
/usr/sbin/qm set 315 --delete unused0
sleep 3
/usr/sbin/qm set 315 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 315 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 315
sleep 3

View File

@@ -0,0 +1,13 @@
#!/bin/bash
until ping -c1 192.168.1.41 >/dev/null 2>&1; do :; done
sleep 45
mount -t nfs 192.168.1.41:/mnt/data/media /mnt/truenasmedia
sleep 15
/usr/sbin/pct start 100
sleep 15
/usr/sbin/pct start 102
sleep 15
/usr/sbin/pct start 107
sleep 15
/usr/sbin/qm start 200

View File

@@ -0,0 +1,88 @@
#!/bin/bash
cd /root/cloud-images
# remove old images
rm * > /dev/null 2>&1
# debian 11 bullseye cloud
wget -q https://cloud.debian.org/images/cloud/bullseye/daily/latest/debian-11-genericcloud-amd64-daily.tar.xz
tar -xvf debian-11-genericcloud-amd64-daily.tar.xz
mv disk.raw debian-11-genericcloud-amd64-daily.raw
/usr/sbin/qm set 301 --delete scsi0
sleep 3
/usr/sbin/qm set 301 --delete unused0
sleep 3
/usr/sbin/qm set 301 --scsi0 local-zfs:0,import-from=/root/cloud-images/debian-11-genericcloud-amd64-daily.raw,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 301 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 301
sleep 3
# debian 12 bookworm cloud
wget -q https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.tar.xz
tar -xvf debian-12-genericcloud-amd64.tar.xz
mv disk.raw debian-12-generic-amd64.raw
/usr/sbin/qm set 302 --delete scsi0
sleep 3
/usr/sbin/qm set 302 --delete unused0
sleep 3
/usr/sbin/qm set 302 --scsi0 local-zfs:0,import-from=/root/cloud-images/debian-12-generic-amd64.raw,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 302 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 302
sleep 3
# ubuntu focal 20.04
wget -q -O ubuntu-20.04-server-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
/usr/sbin/qm set 310 --delete scsi0
sleep 3
/usr/sbin/qm set 310 --delete unused0
sleep 3
/usr/sbin/qm set 310 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-20.04-server-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 310 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 310
sleep 3
# ubuntu jammy 22.04
wget -q -O ubuntu-22.04-server-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
/usr/sbin/qm set 311 --delete scsi0
sleep 3
/usr/sbin/qm set 311 --delete unused0
sleep 3
/usr/sbin/qm set 311 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-server-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 311 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 311
sleep 3
# ubuntu focal 20.04 minimal
wget -q -O ubuntu-20.04-minimal-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img
/usr/sbin/qm set 312 --delete scsi0
sleep 3
/usr/sbin/qm set 312 --delete unused0
sleep 3
/usr/sbin/qm set 312 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-20.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 312 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 312
sleep 3
# ubuntu jammy 22.04 minimal
wget -q -O ubuntu-22.04-minimal-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
/usr/sbin/qm set 313 --delete scsi0
sleep 3
/usr/sbin/qm set 313 --delete unused0
sleep 3
/usr/sbin/qm set 313 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
sleep 3
/usr/sbin/qm set 313 --boot order=scsi0
sleep 3
/usr/sbin/qm cloudinit update 313
sleep 3

View File

@@ -0,0 +1,5 @@
#!/bin/bash
until ping -c1 192.168.1.41 >/dev/null 2>&1; do :; done
sleep 15
/usr/sbin/qm start 211

View File

@@ -0,0 +1,18 @@
#!/bin/bash
#rclone copy /media/raid/Media/ /mnt/truenasmedia/ --create-empty-src-dirs -P
rclone copy /media/raid/Backups/ /mnt/truenasscott/ --create-empty-src-dirs -P
rclone copy /media/raid/Applications/ /mnt/truenasscott/Applications/ --create-empty-src-dirs -P
rclone copy /media/raid/Games/ /mnt/truenasscott/Games/ --create-empty-src-dirs -P
rclone copy /media/raid/Google/ /mnt/truenasscott/Google/ --create-empty-src-dirs -P
rclone copy /media/raid/Kodi/ /mnt/truenasscott/Kodi/ --create-empty-src-dirs -P
rclone copy /media/raid/Miscellaneous/ /mnt/truenasscott/Miscellaneous/ --create-empty-src-dirs -P
rclone copy /media/raid/Pictures/ /mnt/truenasscott/Pictures/ --create-empty-src-dirs -P
rclone copy /media/raid/'Pictures Backup'/ /mnt/truenasscott/'Pictures Backup'/ --create-empty-src-dirs -P
rclone copy /media/raid/Projects/ /mnt/truenasscott/Projects/ --create-empty-src-dirs -P
rclone copy /media/raid/'Rosetta Stone'/ /mnt/truenasscott/'Rosetta Stone'/ --create-empty-src-dirs -P
rclone copy /media/raid/Share/ /mnt/truenasscott/Share/ --create-empty-src-dirs -P
rclone copy /media/raid/'TV Shows'/ /mnt/truenasscott/'TV Shows'/ --create-empty-src-dirs -P
rclone copy /media/raid/'Unsorted Pictures'/ /mnt/truenasscott/'Unsorted Pictures'/ --create-empty-src-dirs -P
rclone copy /media/raid/dockernuc/ /mnt/truenasscott/dockernuc/ --create-empty-src-dirs -P

View File

@@ -0,0 +1,106 @@
#!/bin/bash
HostName="https://remotely.akanealw.com"
Organization="7fbfb541-0720-42cf-b363-ddf13a19fd16"
GUID=$(cat /proc/sys/kernel/random/uuid)
UpdatePackagePath=""
InstallDir="/usr/local/bin/Remotely"
apt-get update
apt-get -y install curl lsb-release apt-transport-https libx11-dev libxrandr-dev unzip libc6-dev libxtst-dev xclip jq
ETag=$(curl --head $HostName/Content/Remotely-Linux.zip | grep -i "etag" | cut -d' ' -f 2)
LogPath="/var/log/remotely/Agent_Install.log"
mkdir -p /var/log/remotely
Args=( "$@" )
ArgLength=${#Args[@]}
for (( i=0; i<${ArgLength}; i+=2 ));
do
if [ "${Args[$i]}" = "--uninstall" ]; then
systemctl stop remotely-agent
rm -r -f $InstallDir
rm -f /etc/systemd/system/remotely-agent.service
systemctl daemon-reload
exit
elif [ "${Args[$i]}" = "--path" ]; then
UpdatePackagePath="${Args[$i+1]}"
fi
done
if [ -z "$ETag" ]; then
echo "ETag is empty. Aborting install." | tee -a $LogPath
exit 1
fi
debianVersion=$(lsb_release -r -s)
wget -q https://packages.microsoft.com/config/debian/$debianVersion/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
#apt-get -y install apt-transport-https
apt-get -y install dotnet-runtime-7.0
rm packages-microsoft-prod.deb
#apt-get -y install libx11-dev libxrandr-dev unzip libc6-dev libxtst-dev xclip jq
if [ -f "$InstallDir/ConnectionInfo.json" ]; then
SavedGUID=`cat "$InstallDir/ConnectionInfo.json" | jq -r '.DeviceID'`
if [[ "$SavedGUID" != "null" && -n "$SavedGUID" ]]; then
GUID="$SavedGUID"
fi
fi
rm -r -f $InstallDir
rm -f /etc/systemd/system/remotely-agent.service
mkdir -p $InstallDir
if [ -z "$UpdatePackagePath" ]; then
echo "Downloading client." | tee -a $LogPath
wget -q -O /tmp/Remotely-Linux.zip $HostName/Content/Remotely-Linux.zip
else
echo "Copying install files." | tee -a $LogPath
cp "$UpdatePackagePath" /tmp/Remotely-Linux.zip
rm -f "$UpdatePackagePath"
fi
unzip -o /tmp/Remotely-Linux.zip -d $InstallDir
rm -f /tmp/Remotely-Linux.zip
chmod +x $InstallDir/Remotely_Agent
chmod +x $InstallDir/Desktop/Remotely_Desktop
connectionInfo="{
\"DeviceID\":\"$GUID\",
\"Host\":\"$HostName\",
\"OrganizationID\": \"$Organization\",
\"ServerVerificationToken\":\"\"
}"
echo "$connectionInfo" > $InstallDir/ConnectionInfo.json
curl --head $HostName/Content/Remotely-Linux.zip | grep -i "etag" | cut -d' ' -f 2 > $InstallDir/etag.txt
echo Creating service. | tee -a $LogPath
serviceConfig="[Unit]
Description=The Remotely agent used for remote access.
[Service]
WorkingDirectory=$InstallDir
ExecStart=$InstallDir/Remotely_Agent
Restart=always
StartLimitIntervalSec=0
RestartSec=10
[Install]
WantedBy=graphical.target"
echo "$serviceConfig" > /etc/systemd/system/remotely-agent.service
systemctl enable remotely-agent
systemctl restart remotely-agent
echo Install complete. | tee -a $LogPath

View File

@@ -0,0 +1,106 @@
#!/bin/bash
HostName="https://remotely.akanealw.com"
Organization="7fbfb541-0720-42cf-b363-ddf13a19fd16"
GUID=$(cat /proc/sys/kernel/random/uuid)
UpdatePackagePath=""
InstallDir="/usr/local/bin/Remotely"
apt-get update
apt-get -y install curl lsb-release libx11-dev libxrandr-dev unzip libc6-dev libxtst-dev xclip jq apt-transport-https
ETag=$(curl --head $HostName/Content/Remotely-Linux.zip | grep -i "etag" | cut -d' ' -f 2)
LogPath="/var/log/remotely/Agent_Install.log"
mkdir -p /var/log/remotely
Args=( "$@" )
ArgLength=${#Args[@]}
for (( i=0; i<${ArgLength}; i+=2 ));
do
if [ "${Args[$i]}" = "--uninstall" ]; then
systemctl stop remotely-agent
rm -r -f $InstallDir
rm -f /etc/systemd/system/remotely-agent.service
systemctl daemon-reload
exit
elif [ "${Args[$i]}" = "--path" ]; then
UpdatePackagePath="${Args[$i+1]}"
fi
done
if [ -z "$ETag" ]; then
echo "ETag is empty. Aborting install." | tee -a $LogPath
exit 1
fi
ubuntuVersion=$(lsb_release -r -s)
wget -q https://packages.microsoft.com/config/ubuntu/$ubuntuVersion/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
#apt-get -y install apt-transport-https
apt-get -y install dotnet-runtime-7.0
rm packages-microsoft-prod.deb
#apt-get -y install libx11-dev libxrandr-dev unzip libc6-dev libxtst-dev xclip jq
if [ -f "$InstallDir/ConnectionInfo.json" ]; then
SavedGUID=`cat "$InstallDir/ConnectionInfo.json" | jq -r '.DeviceID'`
if [[ "$SavedGUID" != "null" && -n "$SavedGUID" ]]; then
GUID="$SavedGUID"
fi
fi
rm -r -f $InstallDir
rm -f /etc/systemd/system/remotely-agent.service
mkdir -p $InstallDir
if [ -z "$UpdatePackagePath" ]; then
echo "Downloading client." | tee -a $LogPath
wget -q -O /tmp/Remotely-Linux.zip $HostName/Content/Remotely-Linux.zip
else
echo "Copying install files." | tee -a $LogPath
cp "$UpdatePackagePath" /tmp/Remotely-Linux.zip
rm -f "$UpdatePackagePath"
fi
unzip -o /tmp/Remotely-Linux.zip -d $InstallDir
rm -f /tmp/Remotely-Linux.zip
chmod +x $InstallDir/Remotely_Agent
chmod +x $InstallDir/Desktop/Remotely_Desktop
connectionInfo="{
\"DeviceID\":\"$GUID\",
\"Host\":\"$HostName\",
\"OrganizationID\": \"$Organization\",
\"ServerVerificationToken\":\"\"
}"
echo "$connectionInfo" > $InstallDir/ConnectionInfo.json
curl --head $HostName/Content/Remotely-Linux.zip | grep -i "etag" | cut -d' ' -f 2 > $InstallDir/etag.txt
echo Creating service. | tee -a $LogPath
serviceConfig="[Unit]
Description=The Remotely agent used for remote access.
[Service]
WorkingDirectory=$InstallDir
ExecStart=$InstallDir/Remotely_Agent
Restart=always
StartLimitIntervalSec=0
RestartSec=10
[Install]
WantedBy=graphical.target"
echo "$serviceConfig" > /etc/systemd/system/remotely-agent.service
systemctl enable remotely-agent
systemctl restart remotely-agent
echo Install complete. | tee -a $LogPath

View File

@@ -0,0 +1,15 @@
rsync -azvP -e "ssh -i ~/.ssh/truenas" --progress \
--include=/ \
--include=/home/*** \
--include=/etc \
--include=/etc/fstab \
--include=/etc/dnsmasq.d/*** \
--include=/etc/gitea/*** \
--include=/etc/nginx/*** \
--include=/etc/wireguard/*** \
--include=/srv/*** \
--include=/var \
--include=/var/lib \
--include=/var/lib/gitea/*** \
--exclude=* \
/ root@192.168.1.41:/mnt/data/backups/fileserverbackup/$(/bin/date +%Y-%m-%d)

View File

@@ -0,0 +1,10 @@
#!/bin/bash
#rsync -azvP -e "ssh -i ~/.ssh/debiantest" --progress \
--include=/ \
--include=/home/ \
--include=/home/akanealw \
--include=/home/akanealw/docker \
--include=/home/akanealw/docker/appdata/*** \
--exclude=* \
root@192.168.1.33:/ /mnt/backups/dockerservertest/$(/bin/date +%Y-%m-%d)

View File

@@ -0,0 +1,12 @@
rsync -azvP -e "ssh -i ~/.ssh/publickey" --progress \
--exclude=/etc/fstab \
--exclude=/etc/network/* \
--exclude=/lib/modules \
--exclude=/proc/* \
--exclude=/tmp/* \
--exclude=/sys/* \
--exclude=/dev/* \
--exclude=/mnt/* \
--exclude=/boot/* \
--exclude=/root/* \
hostname:/ /

View File

@@ -0,0 +1,4 @@
#!/bin/bash
rsync -azvP -e "ssh -i ~/.ssh/proxyserver" --progress \
/mnt/backups/dockerservertest/2023-07-04/* root@192.168.1.4:/

View File

@@ -0,0 +1,4 @@
#!/bin/bash
rsync -avP --rsh=ssh truenas::truenas-backups/ /mnt/pve/external-backup/backups/
rsync -avP --rsh=ssh truenas::truenas-storage/ /mnt/pve/external-backup/storage/

View File

@@ -0,0 +1 @@
0 */12 * * * /home/akanealw/serverbackup.sh >> /home/akanealw/$(hostname)-backup.log

View File

@@ -0,0 +1,2 @@
# nfs shares
192.168.1.41:/mnt/data/backups/serverbackups /mnt/backups nfs defaults,nolock,soft 0 0

View File

@@ -0,0 +1,6 @@
rsync -arzv --mkpath --delete --no-links /home/akanealw/ /mnt/backups/$(hostname)/akanealw/
rsync -arzv --mkpath /var/spool/cron/crontabs/ /mnt/backups/$(hostname)/cron/crontabs/
rsync -arzv --mkpath --delete --no-links --exclude 'ipc-socket' --exclude 'ibtmp1' /opt/docker/ /mnt/backups/$(hostname)/docker/
rsync -arzv --mkpath /etc/fstab /mnt/backups/$(hostname)/fstab
rsync -arzv --mkpath /etc/network/interfaces /mnt/backups/$(hostname)/
rsync -arzv --mkpath /etc/samba/smb.conf /mnt/backups/$(hostname)/smb.conf

View File

@@ -0,0 +1,2 @@
docker compose -f /opt/docker/admin-compose.yml up -d
docker compose -f /opt/docker/docker-compose.yml up -d

View File

@@ -0,0 +1,2 @@
docker compose -f /opt/docker/docker-compose.yml down
docker compose -f /opt/docker/admin-compose.yml down

View File

@@ -0,0 +1,21 @@
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.30:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.31:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.32:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.33:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak root@192.168.1.34:/root
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.35:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.36:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.37:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.38:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.39:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.40:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.41:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.42:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.43:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.44:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.45:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.46:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.47:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.48:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.49:/home/akanealw
sshpass -p 8ung1e1! scp -v ./nanorc.bak akanealw@192.168.1.50:/home/akanealw

View File

@@ -0,0 +1,82 @@
#!/bin/bash
# create akanealw file in /etc/sudoers.d
if [[ ! -f /etc/sudoers.d/akanealw ]] ; then
echo "akanealw ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/akanealw
fi
# remove all motd
apt-get remove --purge update-motd > /dev/null 2>&1
rm /etc/default/motd-news > /dev/null 2>&1
rm -r /etc/update-motd.d > /dev/null 2>&1
rm /etc/motd > /dev/null 2>&1
# update and upgrade
apt-get update
apt-get upgrade -y
# download and install packages
apt-get install -y lsb-release cron sudo nano curl wget zip unzip git rsync man-db cifs-utils nfs-common parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
# git config
git config --global credential.helper store
git config --global user.name "akanealw"
git config --global user.email "akanealw@gmail.com"
git config --global init.defaultBranch main
# set input preferences
if [[ ! -f /etc/inputrc.bak ]] ; then
cp /etc/inputrc /etc/inputrc.bak > /dev/null 2>&1
fi
rm /etc/inputrc > /dev/null 2>&1
cp /etc/inputrc.bak /etc/inputrc
echo "" >> /etc/inputrc
echo "set completion-ignore-case On" >> /etc/inputrc
# set bash preferences and aliases
if [[ -f /etc/bash.bashrc.default ]] ; then
mv /etc/bash.bashrc.default /etc/bash.bashrc.bak > /dev/null 2>&1
fi
if [[ ! -f /etc/bash.bashrc.bak ]] ; then
cp /etc/bash.bashrc /etc/bash.bashrc.bak > /dev/null 2>&1
fi
rm /etc/bash.bashrc > /dev/null 2>&1
cp /etc/bash.bashrc.bak /etc/bash.bashrc
echo "" >> /etc/bash.bashrc
echo "# custom settings and aliases" >> /etc/bash.bashrc
echo "set -o noclobber" >> /etc/bash.bashrc
echo "alias lsa='ls -alhvF'" >> /etc/bash.bashrc
echo "alias systart='sudo systemctl start'" >> /etc/bash.bashrc
echo "alias systop='sudo systemctl stop'" >> /etc/bash.bashrc
echo "alias sysrest='sudo systemctl restart'" >> /etc/bash.bashrc
echo "alias systat='sudo systemctl status'" >> /etc/bash.bashrc
echo "alias aptupy='sudo apt update && sudo apt upgrade -y'" >> /etc/bash.bashrc
echo "alias aptiy='sudo apt install -y'" >> /etc/bash.bashrc
echo "alias aptry='sudo apt remove -y'" >> /etc/bash.bashrc
echo "alias aptrpy='sudo apt remove --purge -y'" >> /etc/bash.bashrc
echo "alias aptary='sudo apt autoremove -y'" >> /etc/bash.bashrc
echo "alias apts='sudo apt search'" >> /etc/bash.bashrc
echo "alias aptl='sudo apt list --installed'" >> /etc/bash.bashrc
echo "alias aptsh='sudo apt show'" >> /etc/bash.bashrc
echo "alias aptac='sudo apt-get autoclean'" >> /etc/bash.bashrc
echo "alias dpkgi='sudo dpkg -i'" >> /etc/bash.bashrc
echo "alias tmxls='tmux ls'" >> /etc/bash.bashrc
echo "alias tmxa='tmux attach -t'" >> /etc/bash.bashrc
echo "alias dc='docker compose'" >> /etc/bash.bashrc
echo "alias dcup='docker compose up -d'" >> /etc/bash.bashrc
echo "alias dcaup='docker compose -f admin-compose.yml up -d'" >> /etc/bash.bashrc
echo "alias dcdown='docker compose down'" >> /etc/bash.bashrc
echo "alias dcadown='docker compose -f admin-compose.yml down'" >> /etc/bash.bashrc
echo "alias dcpull='docker compose pull'" >> /etc/bash.bashrc
echo "alias dcapull='docker compose -f admin-compose.yml pull'" >> /etc/bash.bashrc
echo "alias dps='docker ps'" >> /etc/bash.bashrc
echo "alias dipaf='docker image prune -a -f'" >> /etc/bash.bashrc
# create tmux config
rm /etc/tmux.conf* > /dev/null 2>&1
echo "unbind C-b" >> /etc/tmux.conf
echo "set-option -g prefix C-a" >> /etc/tmux.conf
echo "bind-key C-a send-prefix" >> /etc/tmux.conf
# enable ping for non-root users
setcap 'cap_net_admin,cap_net_raw+ep' $(which ping)