initialize repo
This commit is contained in:
commit
5c89710983
3 changed files with 97 additions and 0 deletions
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# scripts
|
||||||
|
|
||||||
|
A collection of scripts that I wrote and use occasionally, or simply stuff that I want to save but isn't really finished or meant to be published alone.
|
||||||
|
|
55
borg.sh
Executable file
55
borg.sh
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
export BORG_REPO='/storage/backup'
|
||||||
|
export BORG_PASSPHRASE='discount-wham-untruth-apostle-mastiff-expand-foster-zealous-tricky'
|
||||||
|
export CLOUDDEST='backup_1:/backup'
|
||||||
|
export BORG_CACHE_DIR='/storage/backup/user/appdata/borg/cache/'
|
||||||
|
export BORG_BASE_DIR='/storage/backup/user/appdata/borg/'
|
||||||
|
|
||||||
|
|
||||||
|
echo "$(date "+%m-%d-%Y %T") : Borg backup has started" 2>&1 | tee -a $LOGFILE
|
||||||
|
SECONDS=0
|
||||||
|
|
||||||
|
|
||||||
|
borg create \
|
||||||
|
--verbose \
|
||||||
|
--info \
|
||||||
|
--list \
|
||||||
|
--stats \
|
||||||
|
--show-rc \
|
||||||
|
--compression lz4 \
|
||||||
|
--exclude-caches \
|
||||||
|
$BORG_REPO::"root-{now:%Y-%m-%d}" \
|
||||||
|
/home \
|
||||||
|
/etc \
|
||||||
|
/usr/src/linux \
|
||||||
|
|
||||||
|
backup_exit=$?
|
||||||
|
|
||||||
|
|
||||||
|
borg prune \
|
||||||
|
--list \
|
||||||
|
--prefix "$(hostname)-" \
|
||||||
|
--show-rc \
|
||||||
|
--keep-daily 7 \
|
||||||
|
--keep-weekly 4 \
|
||||||
|
--keep-monthly 6 \
|
||||||
|
prune_exit=$?
|
||||||
|
|
||||||
|
|
||||||
|
global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
|
||||||
|
|
||||||
|
if [ ${global_exit} -eq 0 ];
|
||||||
|
then
|
||||||
|
borgstart=$SECONDS
|
||||||
|
echo "$(date "+%m-%d-%Y %T") : Borg backup completed in $(($borgstart/ 3600))h:$(($borgstart% 3600/60))m:$(($borgstart% 60))s" | tee -a >> $LOGFILE 2>&1
|
||||||
|
|
||||||
|
#Reset timer
|
||||||
|
SECONDS=0
|
||||||
|
echo "$(date "+%m-%d-%Y %T") : Rclone Borg sync has started" >> $LOGFILE
|
||||||
|
rclone sync $BORG_REPO $CLOUDDEST -P --stats 1s -v 2>&1 | tee -a $LOGFILE
|
||||||
|
rclonestart=$SECONDS
|
||||||
|
echo "$(date "+%m-%d-%Y %T") : Rclone Borg sync completed in $(($rclonestart/ 3600))h:$(($rclonestart% 3600/60))m:$(($rclonestart% 60))s" 2>&1 | tee -a $LOGFILE
|
||||||
|
# All other errors
|
||||||
|
else
|
||||||
|
echo "$(date "+%m-%d-%Y %T") : Borg has errors code:" $global_exit 2>&1 | tee -a $LOGFILE
|
||||||
|
fi
|
||||||
|
exit ${global_exit}
|
38
kernel_update.sh
Executable file
38
kernel_update.sh
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Note: this script is meant to run post emerge --depclean
|
||||||
|
eselect kernel set 1
|
||||||
|
|
||||||
|
cp /usr/src/linux-$(uname -r)/.config /usr/src/linux
|
||||||
|
|
||||||
|
|
||||||
|
genkernel --install --lvm --luks --no-mountboot --no-ramdisk-modules \
|
||||||
|
--compress-initramfs-type=lz4 --initramfs-filename=initramfs.img initramfs
|
||||||
|
|
||||||
|
if [ -d "/usr/src/initramfs" ]; then
|
||||||
|
lz4cat /boot/initramfs.img | cpio --directory=/usr/src/initramfs -imdv
|
||||||
|
else
|
||||||
|
echo "/usr/src/initramfs does not exist. exiting"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /usr/src/linux
|
||||||
|
|
||||||
|
make -j16
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
mount /dev/nvme0n1p1 /boot/efi
|
||||||
|
cp arch/x86/boot/bzImage /boot/efi/EFI/Gentoo/gentoox64.efi
|
||||||
|
else
|
||||||
|
echo "Kernel compilation failed. Exiting"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Signing for SecureBoot, expected directory is /etc/efikeys/
|
||||||
|
|
||||||
|
cd /etc/efikeys/
|
||||||
|
|
||||||
|
sbsign --key db.key --cert db.crt --output /boot/efi/EFI/Gentoo/gentoox64.efi /boot/efi/EFI/Gentoo/gentoox64.efi
|
||||||
|
|
||||||
|
umount /boot/efi
|
Loading…
Reference in a new issue