From: Chris Koeritz Date: Thu, 2 Feb 2017 22:39:53 +0000 (-0500) Subject: customization good and more cleaning X-Git-Tag: 2.140.90~235 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=aa3c39c42b175ba42febe295be6da7fae47713a8;p=feisty_meow.git customization good and more cleaning moving out an old script and relocating some to more rational folders. --- diff --git a/scripts/files/checker_report.sh b/scripts/files/checker_report.sh deleted file mode 100644 index 3dd649ab..00000000 --- a/scripts/files/checker_report.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# checker_report: runs the checker utility against all files in a directory, -# in such a way that the file count can be very high without blowing its -# mind, and without any extra headers in the report. - -source $FEISTY_MEOW_SCRIPTS/core/functions.sh - -dirname="$1"; shift -outfile="$1"; shift # optional parm. - -if [ -z "$dirname" ]; then - echo "This script requires one directory on which to make a checker report." - echo "Additionally, you can specify an output file as the second parameter." - exit 1 -fi - -if [ -z "$outfile" ]; then - outfile="$HOME/checker_report_$(hostname)_$(date_stringer).txt" -fi - -if [ -f "$outfile" ]; then - rm "$outfile" -fi - -temp_file_list="$(mktemp /tmp/file_list_temporary.XXXXXX)" - -find "$dirname" -type f >"$temp_file_list" -###-exec echo \"{}\" ';' -while read input_text; do - checker -q -b "$input_text" 2>&1 >>"$outfile" -done <"$temp_file_list" - - diff --git a/scripts/files/dir_zero_entries.sh b/scripts/files/dir_zero_entries.sh deleted file mode 100644 index 0f4ec900..00000000 --- a/scripts/files/dir_zero_entries.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -for i in $*; do - dirname="$i" - - # make sure this is not a subversion or CVS directory. - if [[ $i =~ .*\.svn.* || $i =~ .*CVS.* ]]; then -#echo directory matched svn or cvs folder - continue; - fi - - # only operate on existent dirs. - if [ ! -d "$i" ]; then - continue; - fi - - entries=($(ls -1 "$i")) - ent_len=${#entries[*]} -#echo dir $i has entries: -#echo ${entries[*]} -#echo len is $ent_len - if [ $ent_len -eq 0 ]; then - # this directory has nothing! -#echo "has zero ents!" - echo $i - fi -done - diff --git a/scripts/files/dos_perm.sh b/scripts/files/dos_perm.sh deleted file mode 100644 index 89124375..00000000 --- a/scripts/files/dos_perm.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# dos_perm: whacks a directory with the most open set of permissions -# available to the dos/windoze attrib command. - -folder="$1"; shift - -if [ -z "$folder" ]; then - echo "This program requires a folder to set the permissions on. That folder and all" - echo "files in it will be opened up to as full a permission level as DOS's attrib" - echo "command is capable of." - exit 3 -fi - -folder="${folder}/" # add a slash to ensure there's at least one after drive letters. - -dos_folder=$(echo $folder | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' | sed -e 's/\//\\\\/g') -#echo dos folder is $dos_folder - -attrib -r -s -h //s //d "$dos_folder\\*" - diff --git a/scripts/files/easy_perm.sh b/scripts/files/easy_perm.sh deleted file mode 100644 index 6663909b..00000000 --- a/scripts/files/easy_perm.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# easyperm: traverses directory trees and sets the permissions to a completely -# accessible value (rwxrwxrwx for directories and rw-rw-rw- for files). - -declare -a args=("$@") - -if [ -z "${args[*]}" ]; then - echo "no arguments provided." - exit 1; -fi - -for (( i=0; i < ${#args[*]}; i++ )); do - current="${args[i]}" -# echo "curr is $current" - - find "$current" -type d -exec chmod 777 {} ';' -# >/dev/null 2>/dev/null - find "$current" -type f -exec chmod 666 {} ';' -# >/dev/null 2>/dev/null -done - diff --git a/scripts/files/exe_perm.sh b/scripts/files/exe_perm.sh deleted file mode 100644 index 6d8ed90e..00000000 --- a/scripts/files/exe_perm.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# exeperm sets the permissions to an executable value, as for a directory of -# binary files. (rwxr-xr-x for both directories and files) - -declare -a args=("$@") - -if [ -z "${args[*]}" ]; then - echo "no arguments provided." - exit 1; -fi - -for (( i=0; i < ${#args[*]}; i++ )); do - current="${args[i]}" -# echo "curr is $current" - - find "$current" -type d -exec chmod 755 {} ';' -# >/dev/null 2>/dev/null - find "$current" -type f -exec chmod 755 {} ';' -# >/dev/null 2>/dev/null -done - diff --git a/scripts/files/fix_game_perms.sh b/scripts/files/fix_game_perms.sh deleted file mode 100644 index 9d214808..00000000 --- a/scripts/files/fix_game_perms.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# fixes the permissions of files in the local games directory so that -# everyone can run or read them if the owner could. - -sudo find /home/games -type f -perm /100 -exec chmod a+x {} ';' -sudo find /home/games -type f -perm /400 -exec chmod a+r {} ';' - -sudo find /home/games -type d -exec chmod a+rx {} ';' - diff --git a/scripts/files/harsh_perm.sh b/scripts/files/harsh_perm.sh deleted file mode 100644 index f08c77da..00000000 --- a/scripts/files/harsh_perm.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# harshperm traverses directory trees and sets the permissions to a restricted -# value (rwx------ for directories and rw------- for files). - -declare -a args=("$@") - -if [ -z "${args[*]}" ]; then - echo "no arguments provided." - exit 1; -fi - -for (( i=0; i < ${#args[*]}; i++ )); do - current="${args[i]}" -# echo "curr is $current" - - find "$current" -type d -exec chmod 700 {} ';' -# >/dev/null 2>/dev/null - find "$current" -type f -exec chmod 600 {} ';' -# >/dev/null 2>/dev/null -done diff --git a/scripts/files/normal_perm.sh b/scripts/files/normal_perm.sh deleted file mode 100644 index 73a7f941..00000000 --- a/scripts/files/normal_perm.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# normal_perm: traverses directory trees and sets the permissions to a -# standard accessibility value. for fred, this is rwxr-xr-x for directories -# and rw-r--r-- for files. - -declare -a args=("$@") - -if [ -z "${args[*]}" ]; then - echo "no arguments provided." - exit 1; -fi - -for (( i=0; i < ${#args[*]}; i++ )); do - current="${args[i]}" -# echo "curr is $current" - find "$current" -type d -exec chmod 755 {} ';' -### >/dev/null 2>/dev/null - find "$current" -type f -exec chmod 644 {} ';' -### >/dev/null 2>/dev/null -done - diff --git a/scripts/rip_burn/checker_report.sh b/scripts/rip_burn/checker_report.sh new file mode 100644 index 00000000..3dd649ab --- /dev/null +++ b/scripts/rip_burn/checker_report.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# checker_report: runs the checker utility against all files in a directory, +# in such a way that the file count can be very high without blowing its +# mind, and without any extra headers in the report. + +source $FEISTY_MEOW_SCRIPTS/core/functions.sh + +dirname="$1"; shift +outfile="$1"; shift # optional parm. + +if [ -z "$dirname" ]; then + echo "This script requires one directory on which to make a checker report." + echo "Additionally, you can specify an output file as the second parameter." + exit 1 +fi + +if [ -z "$outfile" ]; then + outfile="$HOME/checker_report_$(hostname)_$(date_stringer).txt" +fi + +if [ -f "$outfile" ]; then + rm "$outfile" +fi + +temp_file_list="$(mktemp /tmp/file_list_temporary.XXXXXX)" + +find "$dirname" -type f >"$temp_file_list" +###-exec echo \"{}\" ';' +while read input_text; do + checker -q -b "$input_text" 2>&1 >>"$outfile" +done <"$temp_file_list" + + diff --git a/scripts/security/dos_perm.sh b/scripts/security/dos_perm.sh new file mode 100644 index 00000000..89124375 --- /dev/null +++ b/scripts/security/dos_perm.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# dos_perm: whacks a directory with the most open set of permissions +# available to the dos/windoze attrib command. + +folder="$1"; shift + +if [ -z "$folder" ]; then + echo "This program requires a folder to set the permissions on. That folder and all" + echo "files in it will be opened up to as full a permission level as DOS's attrib" + echo "command is capable of." + exit 3 +fi + +folder="${folder}/" # add a slash to ensure there's at least one after drive letters. + +dos_folder=$(echo $folder | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' | sed -e 's/\//\\\\/g') +#echo dos folder is $dos_folder + +attrib -r -s -h //s //d "$dos_folder\\*" + diff --git a/scripts/security/easy_perm.sh b/scripts/security/easy_perm.sh new file mode 100644 index 00000000..6663909b --- /dev/null +++ b/scripts/security/easy_perm.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# easyperm: traverses directory trees and sets the permissions to a completely +# accessible value (rwxrwxrwx for directories and rw-rw-rw- for files). + +declare -a args=("$@") + +if [ -z "${args[*]}" ]; then + echo "no arguments provided." + exit 1; +fi + +for (( i=0; i < ${#args[*]}; i++ )); do + current="${args[i]}" +# echo "curr is $current" + + find "$current" -type d -exec chmod 777 {} ';' +# >/dev/null 2>/dev/null + find "$current" -type f -exec chmod 666 {} ';' +# >/dev/null 2>/dev/null +done + diff --git a/scripts/security/exe_perm.sh b/scripts/security/exe_perm.sh new file mode 100644 index 00000000..6d8ed90e --- /dev/null +++ b/scripts/security/exe_perm.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# exeperm sets the permissions to an executable value, as for a directory of +# binary files. (rwxr-xr-x for both directories and files) + +declare -a args=("$@") + +if [ -z "${args[*]}" ]; then + echo "no arguments provided." + exit 1; +fi + +for (( i=0; i < ${#args[*]}; i++ )); do + current="${args[i]}" +# echo "curr is $current" + + find "$current" -type d -exec chmod 755 {} ';' +# >/dev/null 2>/dev/null + find "$current" -type f -exec chmod 755 {} ';' +# >/dev/null 2>/dev/null +done + diff --git a/scripts/security/fix_game_perms.sh b/scripts/security/fix_game_perms.sh new file mode 100644 index 00000000..9d214808 --- /dev/null +++ b/scripts/security/fix_game_perms.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# fixes the permissions of files in the local games directory so that +# everyone can run or read them if the owner could. + +sudo find /home/games -type f -perm /100 -exec chmod a+x {} ';' +sudo find /home/games -type f -perm /400 -exec chmod a+r {} ';' + +sudo find /home/games -type d -exec chmod a+rx {} ';' + diff --git a/scripts/security/harsh_perm.sh b/scripts/security/harsh_perm.sh new file mode 100644 index 00000000..f08c77da --- /dev/null +++ b/scripts/security/harsh_perm.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# harshperm traverses directory trees and sets the permissions to a restricted +# value (rwx------ for directories and rw------- for files). + +declare -a args=("$@") + +if [ -z "${args[*]}" ]; then + echo "no arguments provided." + exit 1; +fi + +for (( i=0; i < ${#args[*]}; i++ )); do + current="${args[i]}" +# echo "curr is $current" + + find "$current" -type d -exec chmod 700 {} ';' +# >/dev/null 2>/dev/null + find "$current" -type f -exec chmod 600 {} ';' +# >/dev/null 2>/dev/null +done diff --git a/scripts/security/normal_perm.sh b/scripts/security/normal_perm.sh new file mode 100644 index 00000000..73a7f941 --- /dev/null +++ b/scripts/security/normal_perm.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# normal_perm: traverses directory trees and sets the permissions to a +# standard accessibility value. for fred, this is rwxr-xr-x for directories +# and rw-r--r-- for files. + +declare -a args=("$@") + +if [ -z "${args[*]}" ]; then + echo "no arguments provided." + exit 1; +fi + +for (( i=0; i < ${#args[*]}; i++ )); do + current="${args[i]}" +# echo "curr is $current" + find "$current" -type d -exec chmod 755 {} ';' +### >/dev/null 2>/dev/null + find "$current" -type f -exec chmod 644 {} ';' +### >/dev/null 2>/dev/null +done + diff --git a/scripts/testing/run_test_and_verify.sh b/scripts/testing/run_test_and_verify.sh index cb037459..6ca02e6f 100644 --- a/scripts/testing/run_test_and_verify.sh +++ b/scripts/testing/run_test_and_verify.sh @@ -9,5 +9,5 @@ to_run="$1"; shift input_file="$1"; shift answer_file="$1"; shift -eval "$to_run" < "$input_file" | bash "$FEISTY_MEOW_SCRIPTS/unit_test/verify_correct_input.sh" "$answer_file" +eval "$to_run" < "$input_file" | bash "$FEISTY_MEOW_SCRIPTS/testing/verify_correct_input.sh" "$answer_file"