diff --git a/customscripts/alfa_install_kali.sh b/customscripts/alfa_install_kali.sh deleted file mode 100644 index c8632a5..0000000 --- a/customscripts/alfa_install_kali.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# installs the Alpha AWUS036ACH on kali linux -# has some slowdowns and pauses to work around a stupid issuie i have -git_dir='/tmp/rtl8812au' -git_repo='https://github.com/aircrack-ng/rtl8812au.git' - -# make sure environment is up to date -echo -e "\n\nUPDOOTAN\n\n" -sudo apt update -# sudo apt upgrade -y -# sudo apt dist-upgrade -y - -# install dkms and rtl dkms -# sudo apt-get install dkms -y -# sleep 10 # stupid_error -echo -e "\n\nINSTALLAN PREREQS\n\n" -sudo apt-get install dkms realtek-rtl88xxau-dkms -y - -# download the code -# catch any submodules, only clone one branch, only download with two jobs to save stress # stupid_error -echo -e "\n\nGETTAN DA CODE\n\n" -git clone --recursive --single-branch --jobs 7 $git_repo $git_dir -# sleep 10 # stupid_error - -# build it -cd $git_dir # enter the dir -echo -e "\n\nCOMPILAN\n\n" -make # compile it -# sleep 10 # stupid_error - -# install the module -echo -e "\n\nINSTALLAN\n\n" -sudo make install - -# sleep 10 # stupid_error -# cleanup -# cd ~ -# rm -rf $git_dir -# sleep 10 # stupid_error -echo -e "\n\nAUTOREMOVAN\n\n" -sudo apt autoremove -y - -echo -e "rebooting in 10 seconds!" -sleep 10 - -sudo reboot -# sudo shutdown -r +1 # reboot in 1 minute - -# to uninstall -# sudo apt purge realtek-rtl88xxau-dkms -y -# sudo apt purge dkms -y -# sudo reboot \ No newline at end of file diff --git a/customscripts/Anbernic-Savin-ig.sh b/customscripts/durable_file_archival_management.sh similarity index 50% rename from customscripts/Anbernic-Savin-ig.sh rename to customscripts/durable_file_archival_management.sh index 695a81e..e374463 100644 --- a/customscripts/Anbernic-Savin-ig.sh +++ b/customscripts/durable_file_archival_management.sh @@ -20,30 +20,40 @@ ## 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="$@" +## duplicate/conflict behavior # date shit start_date="$(date)" # date ig # sum text colorz -RED='\033[0;31m' +RED='\033[0;31m' # anmgry red YELLOW='\033[0;33m' # BOLD yellow :"3 GREEN='\033[1;32m' # bold green :3 -RESET='\033[0m' +RESET='\033[0m' # reset color + +echo -e "${GREEN}Script Started at $start_date With $SECONDS Seconds Elapsed on Line number: $LINENO${RESET}" + +# get all dem args into one single fuck (space seperated) +argz="$@" # 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 +set -Eeuo pipefail # fail on any error including pipe fail and use error trap +# backup_dir="/mnt/d/Anbernic_Research_Tinkering_Save" # dir to protect +backup_dir="/mnt/c/Users/human/Downloads" 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 +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 + # on error, fail and dump as much information as possible to terminal, webhook, and error log trap error_handler ERR error_handler () { @@ -54,13 +64,36 @@ error_handler () { 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 +environment_checks () { + # tests if backup dir is a directory and available + if [ ! -d "$backup_dir" ]; then + echo -e "\n\n\n${RED}Supplied backup dir: $backup_dir not present, not available, out of permissions, or is not a directory" + + exit 1 + else + echo -e "${GREEN}OK! Backup Dir GOOD${RESET}" + fi + + # tests current location + if [[ "$PWD" != "$backup_dir" ]]; then + echo -e "\n\n\n${RED}pwd: $PWD does not match specified dir: $backup Dir, FAIL. Exiting.${RESET}\n\n\n" # notify + + exit 1 # exit with error + else + echo -e "${GREEN}OK! Backup Dir IS Current Location!${RESET}" + fi + + # test for error log + if [ ! -f "$path_error_log" ]; then + echo -e "\n\n\n${RED}error log at path: $path_error_log not present, not available, out of permissions, or is not a directory${RESET}\n\n\n" # notify + + exit 1 + else + echo -e "${GREEN}OK! Error Log GOOD${RESET}" + fi + + echo -e "${GREEN}Environment Checks GOOD!${RESET}" +} # 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" @@ -80,7 +113,7 @@ 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 + find "$backup_dir" -prune -o -name ".git" -type f -exec bash -c "for f in \"\$@\"; do if [ -f \"\${f}.sha256\" ]; then continue; fi; sha256sum -c \"\${f}.sha256\" | tee -a \"${path_error_log}\"; done" _ {} + # sum horrifying shitfuck idk webhook "${GREEN}finished calculatin all dem gay af sha256 files\n\t$SECONDS seconds elapsed${RESET}" } @@ -89,56 +122,68 @@ function generate_sha256_checksums () { ## 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 +do_git () { # notify the user of this bullshit - echo -e "${RED}FAggot im doin da fuckin git bullshit even tho is fuckslow${RESET}" + echo -e "${GREEN}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 (?) + if [ ! -d "${backup_dir}/.git" ]; then # if .git dir not be there, initialize it fag + git init # init git if da shit aint there + git branch -m master # set branch to main (?) + git add . + git commit -m "initial auto archive date: $(date)" + else + git add . # add + git commit -m "archive $(date)" # commit wit date + # notify finished with fuckgit + webhook "done doin sum git" 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 +# # 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" -prune -o -name ".git" -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 +# if [[ "$argz" =~ "VALIDATE" ]]; then +check_generate_checksums () { 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 + # find every sha256 file do the checksum + find "$backup_dir" -prune -o -name ".git" -type f -iname "*.sha256" -exec bash -c "echo -e \"${GREEN}\nstarting check sha256sums of files\n\tcurrent file: {}\n\t total elpapsed: $SECONDS seconds\n'; sha256sum -c $1 | tee -a "${path_error_log}"; echo -e 'ARGS: $@\n\n${RESET}\"" \; +} -# 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" +restic_backups () { + 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 +box_force_shutdown () { + # 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 + # hateful cursed powershell call to shut off box ffs + # pwsh.exe -C "Stop-Computer -Force" # i reeally dgaf this is so terribly fuckin cursed +} + +environment_checks +do_git +check_generate_checksums +restic_backups +# box_force_shutdown \ No newline at end of file