Makin a hardcore data protector/archiver/version controller/verifier that will monitor a dir of files and on each change or new file, (after archiving the old versions) a new sha256 checksum is generated, git version control done, and redundant backup archives via restic
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# Quick and Dirty Methods (Bash)
|
||||||
|
show every set variale and its value (one liner)
|
||||||
|
```bash
|
||||||
|
for v in $(compgen -v); do echo "$v:$$v"; done
|
||||||
|
```
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# todo
|
||||||
|
## x make safe and gay mode optional
|
||||||
|
## dont re-fuck existing sha256 files ig
|
||||||
|
## or ig test and leave as is or append new val and date
|
||||||
|
## x joplin export as pdf
|
||||||
|
## x git (?)
|
||||||
|
## x args normalization
|
||||||
|
# x if args contain FAG (case insensitive) den gay and safe mode enabled
|
||||||
|
# x if args contain NUKE (case insensitive) den nuke all dem sha256 files
|
||||||
|
# x if args contain GIT (case insensitive) den ig do da fuckin asshole git b
|
||||||
|
# x if args contain VALIDATE (case insensitive) then verify sha256 cheksums from pre-calculated files
|
||||||
|
## nosleep start and stop
|
||||||
|
## x clean up/create error.log
|
||||||
|
## test for files missing paired sha256 files, log to error.log
|
||||||
|
## test for mismatches to sha256 files log to error.log
|
||||||
|
## x set error trap to ensure all stderr is tee -a'd to terminal and error.log
|
||||||
|
## fast scan for attributes vs slow scan with sha256
|
||||||
|
## both scans always running, alongside looping restic backups
|
||||||
|
## solve any race conditinos
|
||||||
|
## environment check
|
||||||
|
## sanity checks
|
||||||
|
|
||||||
|
echo -e "${GREEN}Script Started at $(date) With 0 Seconds Elapsed on Line number: $LINENO${RESET}"
|
||||||
|
|
||||||
|
# get all dem args into one single fuck
|
||||||
|
argz="$@"
|
||||||
|
|
||||||
|
# date shit
|
||||||
|
start_date="$(date)" # date ig
|
||||||
|
|
||||||
|
# sum text colorz
|
||||||
|
RED='\033[0;31m'
|
||||||
|
YELLOW='\033[0;33m' # BOLD yellow :"3
|
||||||
|
GREEN='\033[1;32m' # bold green :3
|
||||||
|
RESET='\033[0m'
|
||||||
|
|
||||||
|
# do you wanna be a safetyfag or be based?
|
||||||
|
shopt -s nocasematch # magic no case match bs
|
||||||
|
set -Eeuo pipefail # fail on any error including pipe fail
|
||||||
|
backup_dir="/mnt/d/Anbernic_Research_Tinkering_Save" # dir to protect
|
||||||
|
error_log="${backup_dir}/error.log" # errror log path
|
||||||
|
path_error_log="$error_log" # duplicated cus lazy
|
||||||
|
exec 2> >(tee -a "$path_error_log" >&2) # output any stderror to both screen and error log
|
||||||
|
cd "$backup_dir" # enter dir to work in
|
||||||
|
|
||||||
|
# on error, fail and dump as much information as possible to terminal, webhook, and error log
|
||||||
|
trap error_handler ERR
|
||||||
|
error_handler () {
|
||||||
|
infostring="${RED}\n\n\nERROR IN SCRIPT:\n\n\t\$SECONDS Seconds Elapsed\n\tDate $(date)\n\tOn Line: \$LINENO\n\tUsing command \$BASH_COMMAND\n\tReturn Code: \$?\n\tError log: $path_error_log\n\tError Text: \$ERR\v\tRecorded Args: \${@}${RESET}\n\n"
|
||||||
|
webhook "$infostring" true # dump data to terminal and webhook
|
||||||
|
echo -e >> "$path_error_log" # dump data to error log
|
||||||
|
}
|
||||||
|
|
||||||
|
echo -e "${GREEN}Made it past varr declaratgions and such at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
|
||||||
|
|
||||||
|
if [ -f $path_error_log ]; then
|
||||||
|
echo -e "${GREEN}Found $path_error_log clearing at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
|
||||||
|
echo > "$path_error_log" # initialize as empty
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}No $path_error_log fiound, creating at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
|
||||||
|
touch "$path_error_log" # create and initialize
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if [[ "$argz" =~ "FAG" ]]; then
|
||||||
|
# echo -e "\n\n\n${RED}OK FAGGOT YOU RAN ARG1 WITH FAG SO NOW YOU GET FUCKFAG SAFE MNODE LIKE THE QUEER U R${RESET}\nOH YE ALL YA GAY LIL ERRORS NOW LOGGIN TO $path_error_log\n\n\n"
|
||||||
|
# # make da error log for further humiliation\
|
||||||
|
# # if error log present, delete it and replace with blank file
|
||||||
|
# if [ -f "$path_error_log" ]; then
|
||||||
|
# rm -f "$path_error_log" # delete
|
||||||
|
# touch "$path_error_log" # make empty file
|
||||||
|
# fi
|
||||||
|
# # notify the user of what a genuine bitch they are
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# makin a trappy to make sure as fuuuck dat no fucky wucky gets dafuq by meeee
|
||||||
|
# trap '\033[0;31m webhook "SHIT SHIT SHIT SHIT DA EXIT TRAP FUCKIN SPRUNG FFUUUCK\n\tLine number: $LINENO\n\tFailing on command $BASH_COMMAND\y\tResponse code: $?\n\tStderr shown on screen and logged to $path_error_log ${RESET}\nArgs returned: $@\n\t\n\n\033[0m' EXIT
|
||||||
|
|
||||||
|
function generate_sha256_checksums () {
|
||||||
|
webhook "${GREEN}startin calculatin all dem gay af sha256 files\n\t$SECONDS seconds elapsed\n\tDate: $(date)${RESET}"
|
||||||
|
|
||||||
|
# use black magic to generatre da sha256 files
|
||||||
|
find "$backup_dir" -type f -exec bash -c 'for f in "$@"; do if [ -f "${f}.sha256" ]; then continue; fi; sha256sum "$f" > "${f}.sha256"; done' _ {} + # sum horrifying shitfuck idk
|
||||||
|
|
||||||
|
webhook "${GREEN}finished calculatin all dem gay af sha256 files\n\t$SECONDS seconds elapsed${RESET}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ig git is unsuited for version controllin fuckhuge fiels ig
|
||||||
|
## so ig i comment it out
|
||||||
|
## sum git shit to maintain archive or sum shit
|
||||||
|
## if arg1 containz GIT then do da gitshit
|
||||||
|
if [[ "$argz" =~ "GIT" ]]; then
|
||||||
|
# notify the user of this bullshit
|
||||||
|
echo -e "${RED}FAggot im doin da fuckin git bullshit even tho is fuckslow${RESET}"
|
||||||
|
webhook "doin sum git"
|
||||||
|
# do da git conditionally if need be init
|
||||||
|
if [ ! -d .git ]; then # if .git dir not be there, initialize it fag
|
||||||
|
git init # init git if da shit aint there
|
||||||
|
git branch -m main # set branch to main (?)
|
||||||
|
fi
|
||||||
|
git add . # add
|
||||||
|
git commit -m "archive $(date)" # commit wit date
|
||||||
|
# notify finished with fuckgit
|
||||||
|
webhook "done doin sum git"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# do da fookin sha256sums first ig
|
||||||
|
# if arg1 contains NUKE (case insensititve den nuke dem fuckin sha256 fiels)
|
||||||
|
if [[ "$argz" =~ "NUKE" ]]; then
|
||||||
|
webhook "startin sha256 clearin\n\t$SECONDS seconds elapsed"
|
||||||
|
# notify user that they are a fag
|
||||||
|
echo -e "${RED}FAGGOT MODE ENABLED SO IM NUKIN ALL DEM SHA256 FIELS FUCK U${RESET}"
|
||||||
|
# nuke da sha256 files finafuckingky
|
||||||
|
find "$backup_dir" -type f -name "*.sha256" -delete # nuke dem fookan fuckfiels
|
||||||
|
# finished nukan math
|
||||||
|
webhook "${GREEN}finished clearin sha256 fiels\n\t$SECONDS seconds elapsed${RESET}"
|
||||||
|
|
||||||
|
webhook "Now creating new sha256 sums files"
|
||||||
|
generate_sha256_checksums
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check already generated sha256 checksums
|
||||||
|
if [[ "$argz" =~ "VALIDATE" ]]; then
|
||||||
|
webhook "Generating new sha256sums files for those that lack one"
|
||||||
|
generate_sha256_checksums
|
||||||
|
|
||||||
|
webhook "\n\nchecking pre-calculated sha256 sums"
|
||||||
|
# find every sha256 file do the checksum
|
||||||
|
find "$backup_dir" -type f -iname "*.sha256" -exec bash -c "echo -e '${GREEN}\nstarting check sha256sums of files\n\tcurrent file: \$1\n\t total elpapsed: \$SECONDS seconds\n'; sha256 -c \$1 | tee -a '$path_error_log'; echo -e 'ARGS: \$@\n\n${RESET}'" \;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# do da fuckin restic backdoots
|
||||||
|
# run da powershell restic backup scripp finafuckingly
|
||||||
|
webhook "runnin Anbernic backup restic powershell\n\t$SECONDS seconds elapsed"
|
||||||
|
# may god have mercy on my soul for mixing powershell and bash
|
||||||
|
pwsh.exe -File "D:\Anbernic-Hackin-Archive_restic_backup.ps1" # do da restic backup ps1
|
||||||
|
# finished restic backloops
|
||||||
|
webhook "finished runnin restic Anbernic shit\n\t$SECONDS seconds elapsed"
|
||||||
|
|
||||||
|
# shutdown by force of powershell huehhuehue
|
||||||
|
webhook "TIME TO SHUT THE FUCK DOWN WOOOO\n\t$SECONDS Seconds Elapsed\n\tStart Date: $start_date\n\tEnd Date: $(date)" true # true so it pingas mneeee
|
||||||
|
|
||||||
|
# hateful cursed powershell call to shut off box ffs
|
||||||
|
pwsh.exe -C "Stop-Computer -Force" # i reeally dgaf this is so terribly fuckin cursed
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e # bitchass cant be trusted without handholding
|
||||||
|
exec 2>/dev/null # fookin thing gonna be error city bec i cbf so null dem
|
||||||
|
|
||||||
|
echo "Fixan ya fuckin .ssh perms you useless fagat"
|
||||||
|
|
||||||
|
# if ~/.ssh dont exist, maek it
|
||||||
|
if [ ! -d ~/.ssh ]; then
|
||||||
|
echo "bitch u dont even have a fuckin ~/.ssh lemme make dat for you fraggot"
|
||||||
|
mkdir -p ~/.ssh # -p for error control/happydoll
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ~/.ssh dir perms
|
||||||
|
echo "fixin perms on ~/.ssh because you're too dipshitted to do it yourself"
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
|
||||||
|
# privkey perms
|
||||||
|
echo "now im fixin perms on ya asshole private keys you are an embarassmebt to security"
|
||||||
|
chmod 600 ~/.ssh/id_rsa ~/.ssh/id_ed25519 ~/.ssh/config ~/.ssh/id_edchdsa
|
||||||
|
|
||||||
|
# public and less sensititve fiels perms
|
||||||
|
echo "now im fixin da perms on less sensitive files ig FUCK YOU"
|
||||||
|
chmod 644 ~/.ssh/authorized_keys ~/.ssh/known_hosts ~/.ssh/*.pub
|
||||||
|
|
||||||
|
echo "OK FAGGOT IM FINISHED"
|
||||||
|
echo "NEVER SPEAK OF THIS SHAME, FAGGOT"
|
||||||
|
|
||||||
|
exit 0 # always a friendly exit
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
trap: usage: trap [-Plp] [[action] signal_spec ...]
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# todo:
|
||||||
|
## x green/red feedback from conditionals
|
||||||
|
### x system check etc
|
||||||
|
## x green title
|
||||||
|
## x debug
|
||||||
|
## x retcode snitch
|
||||||
|
|
||||||
|
# text formattan
|
||||||
|
RED='\033[0;31m' # error/faggin
|
||||||
|
GREEN='\033[0;32m' # A-OK
|
||||||
|
YELLOW='\033[1;33m' # bold yellow
|
||||||
|
RESET='\033[0m'
|
||||||
|
|
||||||
|
retcode_snitch() {
|
||||||
|
ret=$1
|
||||||
|
|
||||||
|
# check if retcode exits else red error return 1
|
||||||
|
if [ -z "$ret" ]; then
|
||||||
|
echo -e "\t${RED}ERROR: RETCODE EMPTY${RESET}"
|
||||||
|
return 1 # lil error
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if retcode be 0 den green ok
|
||||||
|
if [ "$ret" -eq 0 ]; then
|
||||||
|
echo -e "\t${GREEN}OK${RESET}"
|
||||||
|
else # if not red error display retcode return 1
|
||||||
|
echo -e "\t${RED}ERROR: $ret${RESET}"
|
||||||
|
return 1 # lil erroz
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# if arg3 is FAG den safe and gay mode enbled
|
||||||
|
if [[ $3 == "FAG" ]]; then
|
||||||
|
echo -e "\n\n\n${RED}FAGGOT MODE SELECTED FAGGOT MODE RUNNING\n\tWARNING: YOU ARE A FAGGOT FOR BEING SAFE${RESET}\n\n\n"
|
||||||
|
|
||||||
|
set -e # be a bitch and fail on error
|
||||||
|
retcode_snitch $? # becuz im a bitch
|
||||||
|
fi
|
||||||
|
|
||||||
|
here="$(pwd)" # get da pwd fuuuck
|
||||||
|
pwdhere="$PWD" # difference?
|
||||||
|
|
||||||
|
# substr
|
||||||
|
## parse da shit
|
||||||
|
file_name="$1"
|
||||||
|
file_name_no_ext="${here}/${file_name:0:-4}"
|
||||||
|
|
||||||
|
# defien da fielz
|
||||||
|
file_path_ttf="${file_name_no_ext}.ttf"
|
||||||
|
file_path_bdf="${file_name_no_ext}.bdf"
|
||||||
|
file_path_psf="${file_name_no_ext}.psf"
|
||||||
|
file_path_psf_gz="${file_path_psf}.gz"
|
||||||
|
|
||||||
|
# check for debpoog
|
||||||
|
if [[ $2 == "DEBUG" ]]; then
|
||||||
|
echo -e "\n${YELLOW}BEGIN DEBUG"
|
||||||
|
echo -e "arg1 (ttf file): $1"
|
||||||
|
echo -e "arg2 (debug): $2"
|
||||||
|
echo -e "arg3 (safe mode aka ${RED}FAGGOT MODE${RESET}${YELLOW}): $3"
|
||||||
|
echo -e "file_name: ${file_name}"
|
||||||
|
echo -e "file_name_no_ext: ${file_name_no_ext}"
|
||||||
|
echo -e "here: ${here}"
|
||||||
|
echo -e "pwdhere: ${pwdhere}"
|
||||||
|
echo -e "file_path_ttf: ${file_path_ttf}"
|
||||||
|
echo -e "file_path_bdf: ${file_path_bdf}"
|
||||||
|
echo -e "file_path_psf: ${file_path_psf}"
|
||||||
|
echo -e "file_path_psf_gz: ${file_path_psf_gz}"
|
||||||
|
echo -e "END DEBUG${RESET}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check to see if da packages r installed
|
||||||
|
# if no, install dem
|
||||||
|
## bdf2psf
|
||||||
|
if [ -z $(which bdf2psf) ]; then
|
||||||
|
echo -e "\n${YELLOW}bdf2psf not found, installing...${RESET}\n"
|
||||||
|
|
||||||
|
# updoot
|
||||||
|
sudo apt update
|
||||||
|
retcode_snitch $?
|
||||||
|
|
||||||
|
# install
|
||||||
|
sudo apt install bdf2psf -y
|
||||||
|
retcode_snitch $?
|
||||||
|
fi
|
||||||
|
## otf2bdf
|
||||||
|
if [ -z $(which otf2bdf) ]; then
|
||||||
|
echo -e "\n${YELLOW}otf2bdf not found, installing...${RESET}\n"
|
||||||
|
|
||||||
|
# updoot
|
||||||
|
sudo apt update
|
||||||
|
retcode_snitch $?
|
||||||
|
|
||||||
|
# install
|
||||||
|
sudo apt install otf2bdf -y
|
||||||
|
retcode_snitch $?
|
||||||
|
fi
|
||||||
|
## gzip
|
||||||
|
if [ -z $(which gzip) ]; then
|
||||||
|
echo -e "\n${YELLOW}gzip not found, installing...${RESET}\n"
|
||||||
|
|
||||||
|
# updoot
|
||||||
|
sudo apt update
|
||||||
|
retcode_snitch $?
|
||||||
|
|
||||||
|
# install
|
||||||
|
sudo apt install gzip -y
|
||||||
|
retcode_snitch $?
|
||||||
|
fi
|
||||||
|
## maek sure file ends with ttf case insensisitive
|
||||||
|
shopt -s nocasematch # sum bullshit to maek da regex work
|
||||||
|
if [[ ! $file_name =~ ttf$ ]]; then # if does not end in ttf case insensitive
|
||||||
|
echo -e "\n\n\n${RED}${file_name} is not ttf format! Exiting!${RESET}\n\n\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
## check da ttf exists and is a fiel
|
||||||
|
if [ ! -f "$file_path_ttf" ]; then # if fiel no exit
|
||||||
|
echo -e "\n\n\n${RED}$file_path_ttf is not a valid file! Exiting!${RESET}\n\n\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# convoot
|
||||||
|
## convert ttf to bdf
|
||||||
|
echo -e "\n${GREEN}Converting $file_path_ttf to $file_path_bdf${RESET}\n"
|
||||||
|
otf2bdf -p 16 -r 72 -o "$file_path_bdf" "$file_path_ttf"
|
||||||
|
retcode_snitch $?
|
||||||
|
## convert bdf to psf
|
||||||
|
echo -e "\n${GREEN}Converting $file_path_bdf to $file_path_psf${RESET}\n"
|
||||||
|
bdf2psf "${file_name_no_ext}.bdf" /usr/share/bdf2psf/standard.equivalents /usr/share/bdf2psf/fontsets/Uni1.512 512 "${file_name_no_ext}.psf"
|
||||||
|
retcode_snitch $?
|
||||||
|
## compress psf to psf.gz
|
||||||
|
echo -e "\n${GREEN}Compressing $file_path_psf to $file_path_psf_gz${RESET}\n"
|
||||||
|
gzip "$file_path_psf"
|
||||||
|
retcode_snitch $?
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# get da starting timestamp
|
||||||
|
start_date=$(date)
|
||||||
|
start_seconds=$(date +%s) # unix seconds
|
||||||
|
|
||||||
|
# RED colored text because sonic.exe
|
||||||
|
RED='\033[0;31m'
|
||||||
|
YELLOW='\033[0;33m' # BOLD yellow :"3
|
||||||
|
RESET='\033[0m'
|
||||||
|
|
||||||
|
# sum safety bs idk fam im not a europe
|
||||||
|
# run with FAG as first arg to be safe liek a bitch
|
||||||
|
if [[ "$1" == "FAG" ]]; then
|
||||||
|
# warn user of faggotry
|
||||||
|
echo -e "\n\n\n${RED}FAGGOT MODE ENABLED THIS MEANS YOU ARE A FAGGOT${RESET}\n\n\n"
|
||||||
|
|
||||||
|
# make a safe space for the fag inclined
|
||||||
|
set -euo pipefail # sum safrety shit idk
|
||||||
|
shopt -s nullglob # safrety?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NO REASON **NOT** TO ANNOUNCE MY SHIT 4 FUN
|
||||||
|
echo -e "\n\n\n${RED}BEHOLD I AM RED AS FUUUUCK${RESET}\n${YELLOW}I AM NOW RUNNING AND YOU CAN NOT STOP ME FAGGOT${RESET}\n\n\n"
|
||||||
|
|
||||||
|
# silly trap runs on ANY exit huehuehue also always forces retcode 0 for extra conf
|
||||||
|
## silly trap to be tricky :3
|
||||||
|
trap 'sudo shutdown +5; exit 0' EXIT # shutdown da dinggus pls IN FIVE MINS on exxeic
|
||||||
|
|
||||||
|
# da sillyvars
|
||||||
|
here="/home/princesspi/Downloads/detritus"
|
||||||
|
LOG="$here/log_sha256_test_retcode_duhb.txt"
|
||||||
|
PRIV1="$here/PRIVATE_sda-2026-05-03_1.img"
|
||||||
|
PRIV2="$here/PRIVATE_sda-2026-05-03_2.img"
|
||||||
|
COPYPROTECT="$here/PRIVATE_sda_COPYPROTECT.img"
|
||||||
|
|
||||||
|
# lookit dis fancy ass process substitution PLUS output redirecting~ :fluttercum:
|
||||||
|
exec > >(tee -a "$LOG") 2>&1 # outdootz stdio and stderr both to terminal and to $LOG
|
||||||
|
|
||||||
|
# start notice
|
||||||
|
webhook "\n\n\nstart: $(date)\nLOG: $LOG\nPRIV1: $PRIV1\nPRIV2: $PRIV2\nCOPYPROTECT: $COPYPROTECT\n\n\n" true
|
||||||
|
|
||||||
|
# warn user of hell incoming
|
||||||
|
echo -e "\n\n\n${RED}DOIN DA BORING ASS SLOW SAFETY SHIT KILL ME NOW${RESET}\n\n\n\n"
|
||||||
|
|
||||||
|
# make backup of copy protect
|
||||||
|
start=$SECONDS
|
||||||
|
cp "$COPYPROTECT" "${COPYPROTECT}.bak"
|
||||||
|
cp_code=$? # sillywow
|
||||||
|
chmod 444 "$COPYPROTECT" "${COPYPROTECT}.bak"
|
||||||
|
chmod_code=$?
|
||||||
|
chown root:root "$COPYPROTECT" "${COPYPROTECT}.bak"
|
||||||
|
chown_code=$?
|
||||||
|
echo -e "\n\n\n${YELLOW}Copyprotect complete in $(($SECONDS-$start)) seconds ret: $cp_code chmod ret: $chmod_code chown ret: $chown_code${RESET}\n\n\n"
|
||||||
|
unset start
|
||||||
|
|
||||||
|
# generate dem sha256sums for safety
|
||||||
|
start=$SECONDS
|
||||||
|
sha256sum "$here"/*.img "$here"/*.bak "$here"/*.xz "$here"/*.sh "$here"/*.txt | tee -a "$LOG" # log dem checksumz to da logggy
|
||||||
|
sha256sum_code=$?
|
||||||
|
echo -e "\n\n\n${YELLOW}sha256sum generated of all files in $(($SECONDS-$start)) seconds and saved to $LOG ret: $sha256sum_code${RESET}\n\n\n"
|
||||||
|
unset start
|
||||||
|
|
||||||
|
# log both human readable and num of bytes filesizes
|
||||||
|
du -h "$here"/*.img "$here"/*.xz | tee -a "$LOG"
|
||||||
|
duh_code=$?
|
||||||
|
du -b "$here"/*.img "$here"/*.xz | tee -a "$LOG"
|
||||||
|
dub_code=$?
|
||||||
|
echo -e "\n\n\n${YELLOW}du -h ret: $duh_code du -b ret: $dub_code${RESET}\n\n\n" # ig give me dem retcodez or whatever
|
||||||
|
|
||||||
|
# celebrate finish of prereqs
|
||||||
|
echo -e "\n\n\n${RED}FUCKING GOD DAMNED FINISHED ALL THE BORING SAFETY TUMORS AT $(date)${RESET}\n\n\n"
|
||||||
|
|
||||||
|
# test da xz raw compress
|
||||||
|
start=$SECONDS
|
||||||
|
xz -c "$PRIV2" > "${PRIV2}.xz" # dis maintainz da original too yay
|
||||||
|
xz_code=$? # ysusss gimme retint
|
||||||
|
echo -e "\n\n\n${YELLOW}xz raw compress complete in $(($SECONDS-$start)) seconds xz raw ret: $xz_code${RESET}\n\n\n"
|
||||||
|
unset start
|
||||||
|
|
||||||
|
# test da pishrink fancy+xz compress
|
||||||
|
start=$SECONDS
|
||||||
|
pishrink -v -r -Z -a "$PRIV1" "${PRIV1}.xz"
|
||||||
|
pishrink_code=$? # gimme dat return status pls
|
||||||
|
echo -e "\n\n\n${YELLOW}pishrink+xz complete in $(($SECONDS-$start)) seconds pishrink+xz ret: $pishrink_code${RESET}\n\n\n"
|
||||||
|
unset start
|
||||||
|
|
||||||
|
# xz (all) test+retcode and webhookie
|
||||||
|
start=$SECONDS
|
||||||
|
xz -t "$here"/*.xz | tee -a "$LOG"
|
||||||
|
xz_test_code=$? # mah retcode :3
|
||||||
|
echo -e "\n\n\n${YELLOW}xz test complete in $(($SECONDS-$start)) seconds xz test ret: $xz_test_code${RESET}\n\n\n"
|
||||||
|
unset start
|
||||||
|
|
||||||
|
# return da retcodez ig
|
||||||
|
webhook "\n\n\ncp code: $cp_code\nxz raw: $xz_code\nxz test: $xz_test_code\nsha256sum code: $sha256sum_code\npishrink code: $pishrink_code\n\n\n" true # log dat retcode to webhook
|
||||||
|
|
||||||
|
# notify of $LOG
|
||||||
|
webhook "\n\n\nLOGGIE :3\n$(cat \"$LOG\")\n\n\n" true
|
||||||
|
|
||||||
|
# notify of finish
|
||||||
|
webhook "\n\n\nfuckell it done fuuuck finished: $SECONDS elapsed at $(date)\nPOWERING OFF IN 5 MINUTES\n\n\n" true
|
||||||
|
|
||||||
|
# stop
|
||||||
|
echo -e "\n\n\n${RED}total $SECONDS seconds elapsed finished at $(date) started at ${start_date} finished in $((`date +%s`-$start_seconds)) seconds ${RESET}\n\n\n"
|
||||||
|
|
||||||
|
# manually shut tf off frong with conf exit :3
|
||||||
|
sudo shutdown +5 # delete to shutdown in 5 mins
|
||||||
|
exit 0 # never exit on bad code because conf :3
|
||||||
Reference in New Issue
Block a user