From f62e32a87b2599bebdca57827c773cb1f97a7890 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 1 May 2019 20:34:07 -0400 Subject: [PATCH] dropped the copying of customizations now we just do a link. simple and clean. --- scripts/archival/snarf_feisty_meow.pl | 1 - scripts/core/functions.sh | 120 +++++++++++++++-------- scripts/core/generate_aliases.pl | 3 - scripts/core/reconfigure_feisty_meow.sh | 8 +- scripts/customize/how_to_customize.txt | 8 +- scripts/security/tunnel_zooty_example.sh | 2 +- 6 files changed, 90 insertions(+), 52 deletions(-) diff --git a/scripts/archival/snarf_feisty_meow.pl b/scripts/archival/snarf_feisty_meow.pl index e6c54770..a8086310 100644 --- a/scripts/archival/snarf_feisty_meow.pl +++ b/scripts/archival/snarf_feisty_meow.pl @@ -39,7 +39,6 @@ local($root) = &canonicalize("$FEISTY_MEOW_APEX"); # snarf up all the important directories. # CAK: current as of 2012-05-05. -###moved &backup_hierarchy($snarf_file_base, $number, $root, "customize"); &backup_hierarchy($snarf_file_base, $number, $root, "infobase"); &backup_hierarchy($snarf_file_base, $number, $root, "documentation"); &backup_hierarchy($snarf_file_base, $number, $root, "experiments"); diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 3b782a70..12cc7717 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -484,8 +484,10 @@ if [ -z "$skip_all" ]; then restore_terminal_title } - # copies a set of custom scripts into the proper location for feisty meow - # to merge their functions and aliases with the standard set. + # merges a set of custom scripts into the feisty meow environment. can be + # passed a name to use as the custom scripts source folder (found on path + # $FEISTY_MEOW_SCRIPTS/customize/{name}), or it will try to guess the name + # by using the login name. function recustomize() { local custom_user="$1"; shift @@ -515,50 +517,88 @@ we will skip recustomization, but these other customizations are available: return 1 fi - # prevent permission foul-ups. - my_user="$USER" - # here we definitely want the effective user name (in USER), since - # we don't want, say, fred (as logname) to own all of root's loading - # dock stuff. - chown -R "$my_user:$my_user" \ - "$FEISTY_MEOW_LOADING_DOCK"/* "$FEISTY_MEOW_GENERATED_STORE"/* 2>/dev/null - continue_on_error "chowning feisty meow generated directories to $my_user" - +#hmmm: begin old custom section... +#hmmm: here is where it starts being wrong for a link due to current borked copy approach. +## # prevent permission foul-ups. +## my_user="$USER" +## # here we definitely want the effective user name (in USER), since +## # we don't want, say, fred (as logname) to own all of root's loading +## # dock stuff. +###hmmm: argh, seems a bit heavyweight to do chowning here! +## chown -R "$my_user:$my_user" \ +## "$FEISTY_MEOW_LOADING_DOCK"/* "$FEISTY_MEOW_GENERATED_STORE"/* 2>/dev/null +## continue_on_error "chowning feisty meow generated directories to $my_user" +## +## regenerate >/dev/null +## +## pushd "$FEISTY_MEOW_LOADING_DOCK/custom" &>/dev/null +## incongruous_files="$(bash "$FEISTY_MEOW_SCRIPTS/files/list_non_dupes.sh" "$FEISTY_MEOW_SCRIPTS/customize/$custom_user" "$FEISTY_MEOW_LOADING_DOCK/custom")" +## +## local fail_message="\n +##are the perl dependencies installed? if you're on ubuntu or debian, try this:\n +## $(grep "apt.*perl" $FEISTY_MEOW_APEX/readme.txt)\n +##or if you're on cygwin, then try this (if apt-cyg is available):\n +## $(grep "apt-cyg.*perl" $FEISTY_MEOW_APEX/readme.txt)\n"; +## +## #echo "the incongruous files list is: $incongruous_files" +## # disallow a single character result, since we get "*" as result when nothing exists yet. +## if [ ${#incongruous_files} -ge 2 ]; then +## log_feisty_meow_event "cleaning unknown older overrides..." +## perl "$FEISTY_MEOW_SCRIPTS/files/safedel.pl" $incongruous_files +## continue_on_error "running safedel. $fail_message" +## fi +## popd &>/dev/null +## log_feisty_meow_event "copying custom overrides for $custom_user" +## mkdir -p "$FEISTY_MEOW_LOADING_DOCK/custom" 2>/dev/null +## perl "$FEISTY_MEOW_SCRIPTS/text/cpdiff.pl" "$FEISTY_MEOW_SCRIPTS/customize/$custom_user" "$FEISTY_MEOW_LOADING_DOCK/custom" +## continue_on_error "running cpdiff. $fail_message" +## +## if [ -d "$FEISTY_MEOW_SCRIPTS/customize/$custom_user/scripts" ]; then +## log_feisty_meow_event "copying custom scripts for $custom_user" +###hmmm: could save output to show if an error occurs. +## rsync -avz "$FEISTY_MEOW_SCRIPTS/customize/$custom_user/scripts" "$FEISTY_MEOW_LOADING_DOCK/custom/" &>/dev/null +## continue_on_error "copying customization scripts" +## fi +## regenerate +## +## # prevent permission foul-ups, again. +## chown -R "$my_user:$my_user" \ +## "$FEISTY_MEOW_LOADING_DOCK" "$FEISTY_MEOW_GENERATED_STORE" 2>/dev/null +## continue_on_error "once more chowning feisty meow generated directories to $my_user" +#hmmm: begin old custom section. + +#### + +#hmmm: begin new customization section... + # recreate the feisty meow loading dock. regenerate >/dev/null - pushd "$FEISTY_MEOW_LOADING_DOCK/custom" &>/dev/null - incongruous_files="$(bash "$FEISTY_MEOW_SCRIPTS/files/list_non_dupes.sh" "$FEISTY_MEOW_SCRIPTS/customize/$custom_user" "$FEISTY_MEOW_LOADING_DOCK/custom")" - - local fail_message="\n -are the perl dependencies installed? if you're on ubuntu or debian, try this:\n - $(grep "apt.*perl" $FEISTY_MEOW_APEX/readme.txt)\n -or if you're on cygwin, then try this (if apt-cyg is available):\n - $(grep "apt-cyg.*perl" $FEISTY_MEOW_APEX/readme.txt)\n"; - - #echo "the incongruous files list is: $incongruous_files" - # disallow a single character result, since we get "*" as result when nothing exists yet. - if [ ${#incongruous_files} -ge 2 ]; then - log_feisty_meow_event "cleaning unknown older overrides..." - perl "$FEISTY_MEOW_SCRIPTS/files/safedel.pl" $incongruous_files - continue_on_error "running safedel. $fail_message" + + # jump into the loading dock and make our custom link. + pushd "$FEISTY_MEOW_LOADING_DOCK" &>/dev/null + if [ -h custom ]; then + # there's an existing link, so remove it. + \rm custom + fi + if [ -h custom -o -d custom -o -f custom ]; then + echo " +Due to an over-abundance of caution, we are not going to remove an unexpected +'custom' object in the file system. This is located here: + $(pwd) +" + ls -al . + return 1 fi + + # create the custom folder as a link to the customizations. + ln -s "$FEISTY_MEOW_SCRIPTS/customize/$custom_user" custom + popd &>/dev/null - log_feisty_meow_event "copying custom overrides for $custom_user" - mkdir -p "$FEISTY_MEOW_LOADING_DOCK/custom" 2>/dev/null - perl "$FEISTY_MEOW_SCRIPTS/text/cpdiff.pl" "$FEISTY_MEOW_SCRIPTS/customize/$custom_user" "$FEISTY_MEOW_LOADING_DOCK/custom" - continue_on_error "running cpdiff. $fail_message" - if [ -d "$FEISTY_MEOW_SCRIPTS/customize/$custom_user/scripts" ]; then - log_feisty_meow_event "copying custom scripts for $custom_user" -#hmmm: could save output to show if an error occurs. - rsync -avz "$FEISTY_MEOW_SCRIPTS/customize/$custom_user/scripts" "$FEISTY_MEOW_LOADING_DOCK/custom/" &>/dev/null - continue_on_error "copying customization scripts" - fi + # now take into account all the customizations by regenerating the feisty meow environment. regenerate +#hmmm: end new customization section. - # prevent permission foul-ups, again. - chown -R "$my_user:$my_user" \ - "$FEISTY_MEOW_LOADING_DOCK" "$FEISTY_MEOW_GENERATED_STORE" 2>/dev/null - continue_on_error "once more chowning feisty meow generated directories to $my_user" +#### restore_terminal_title } diff --git a/scripts/core/generate_aliases.pl b/scripts/core/generate_aliases.pl index dbae6f44..faf9e827 100644 --- a/scripts/core/generate_aliases.pl +++ b/scripts/core/generate_aliases.pl @@ -92,17 +92,14 @@ sub rebuild_script_aliases { } if (length($DEBUG_FEISTY_MEOW)) { print "using these alias files:\n"; -#print "HEY IS THIS PROBLEM CHILD?\n"; foreach $i (@ALIAS_DEFINITION_FILES) { local $base_of_dir = &basename(&dirname($i)); local $basename = &basename($i); print " $base_of_dir/$basename\n"; } -#print "WAS PROBLEM CHILD ABOVE HERE?\n"; } # write the aliases for sh and bash scripts. - local $GENERATED_ALIAS_FILE = "$FEISTY_MEOW_LOADING_DOCK/fmc_core_and_custom_aliases.sh"; if (length($DEBUG_FEISTY_MEOW)) { print "writing generated aliases in $GENERATED_ALIAS_FILE...\n"; diff --git a/scripts/core/reconfigure_feisty_meow.sh b/scripts/core/reconfigure_feisty_meow.sh index cf1e1b0f..c0674575 100644 --- a/scripts/core/reconfigure_feisty_meow.sh +++ b/scripts/core/reconfigure_feisty_meow.sh @@ -54,9 +54,11 @@ PERL5LIB=$PERLLIB # make toast out of generated files right away, but leave any custom scripts. find "$FEISTY_MEOW_LOADING_DOCK" -maxdepth 1 -type f -exec perl "$FEISTY_MEOW_SCRIPTS/files/safedel.pl" "{}" ';' # &>/dev/null -if [ ! -d "$FEISTY_MEOW_LOADING_DOCK/custom" ]; then - mkdir "$FEISTY_MEOW_LOADING_DOCK/custom" -fi + +## #no, old: +## if [ ! -d "$FEISTY_MEOW_LOADING_DOCK/custom" ]; then +## mkdir "$FEISTY_MEOW_LOADING_DOCK/custom" +## fi # just a variable we use in here to refer to the generated variables file. FEISTY_MEOW_VARIABLES_LOADING_FILE="$FEISTY_MEOW_LOADING_DOCK/fmc_variables.sh" diff --git a/scripts/customize/how_to_customize.txt b/scripts/customize/how_to_customize.txt index f6ddb3d2..bbd14eea 100644 --- a/scripts/customize/how_to_customize.txt +++ b/scripts/customize/how_to_customize.txt @@ -8,8 +8,8 @@ feisty meow environment. user customization folder organization ====================================== -the user's optional custom folder is located at: -echo $FEISTY_MEOW_SCRIPTS/customize/$(logname) +the user's optional custom folder is usually located at: + $FEISTY_MEOW_SCRIPTS/customize/$(logname) the top-level of the customization folder can store: @@ -26,10 +26,10 @@ custom script aliases there is also a facility for adding aliases automatically for any custom scripts that have been developed by the user. these join the other aliases -provided by the feisty meow environment. +that are already provided by the feisty meow environment. store any custom scripts in the folder: -$FEISTY_MEOW_SCRIPTS/customize/$(logname)/scripts + $FEISTY_MEOW_SCRIPTS/customize/$(logname)/scripts any scripts in that folder (or in a directory under that folder) will automatically be turned into aliases. diff --git a/scripts/security/tunnel_zooty_example.sh b/scripts/security/tunnel_zooty_example.sh index 869370be..4384a7df 100644 --- a/scripts/security/tunnel_zooty_example.sh +++ b/scripts/security/tunnel_zooty_example.sh @@ -1,7 +1,7 @@ #!/bin/bash # this script makes a tunnel for fred's SMTP traffic. -#hmmm: move this script to fred customized stuff +#hmmm: move this script to fred's custom stuff TUNNEL_USER_PLUS_HOST="fred@serene.feistymeow.org" TUNNEL_LINK="-L 14008:localhost:25" -- 2.34.1