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,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