From 8581b6c87895dcc6445a270f42bdc9483ff28ed2 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 25 Jan 2015 21:27:14 -0500 Subject: [PATCH] fixed custom scripts issue, so now the custom folder for a user can have a "scripts" subdirectory. anything in that directory will be referenced as an alias in the environment, so for example, if joe has joe/scripts/toby.sh then a new alias called toby would be added to run that script. --- customizing/fred/{aliases => scripts}/ssh.sh | 4 ++-- scripts/core/functions.sh | 10 ++++++++++ scripts/core/generate_aliases.pl | 8 +++++++- 3 files changed, 19 insertions(+), 3 deletions(-) rename customizing/fred/{aliases => scripts}/ssh.sh (87%) diff --git a/customizing/fred/aliases/ssh.sh b/customizing/fred/scripts/ssh.sh similarity index 87% rename from customizing/fred/aliases/ssh.sh rename to customizing/fred/scripts/ssh.sh index 064ecf8a..2e1b3742 100755 --- a/customizing/fred/aliases/ssh.sh +++ b/customizing/fred/scripts/ssh.sh @@ -5,9 +5,9 @@ source "$FEISTY_MEOW_SCRIPTS/security/pick_credentials.sh" if [ ! -z "$keyfile" ]; then - \ssh -i "$keyfile" -X $* + \ssh -i "$keyfile" -X -C -c blowfish-cbc $* else - \ssh -X $* + \ssh -X -C -c blowfish-cbc $* fi if [ $? -eq 0 ]; then diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 3024f820..c7971337 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -339,6 +339,16 @@ if [ -z "$skip_all" ]; then echo "copying custom overrides for $user" mkdir "$FEISTY_MEOW_GENERATED/custom" 2>/dev/null perl "$FEISTY_MEOW_SCRIPTS/text/cpdiff.pl" "$FEISTY_MEOW_DIR/customizing/$user" "$FEISTY_MEOW_GENERATED/custom" + # set up any custom script files which we'll add as aliases. +# if [ -e "$FEISTY_MEOW_GENERATED/custom/scripts" ]; then +# echo removing older custom scripts. +# rm -rf "$FEISTY_MEOW_GENERATED/custom/scripts" +# fi + if [ -d "$FEISTY_MEOW_DIR/customizing/$user/scripts" ]; then + echo "copying custom scripts for $user" + cp -v -R "$FEISTY_MEOW_DIR/customizing/$user/scripts" "$FEISTY_MEOW_GENERATED/custom/" + fi + echo regenerate } diff --git a/scripts/core/generate_aliases.pl b/scripts/core/generate_aliases.pl index 80f52b77..8408b583 100644 --- a/scripts/core/generate_aliases.pl +++ b/scripts/core/generate_aliases.pl @@ -195,7 +195,8 @@ open(she, ">> $FEISTY_MEOW_GENERATED/fmc_aliases_for_scripts.sh"); #@shell_files = sort(readdir(scripts)); #print "scripts: @shell_files\n"; -@shell_files = &load_file_names("$FEISTY_MEOW_SCRIPTS"); +@shell_files = (&load_file_names("$FEISTY_MEOW_SCRIPTS"), + &load_file_names("$FEISTY_MEOW_GENERATED/custom/scripts")); # construct aliases for items in the scripts directory. foreach $file (@shell_files) { @@ -218,6 +219,11 @@ foreach $file (@shell_files) { foreach $subfile (@subdir_files) { push(@shell_files, "$file/$subfile"); } + } elsif (-f "$FEISTY_MEOW_GENERATED/custom/scripts/$file") { + # if we see a file in the auto-generated area that comes from the + # customized scripts folder, we add it as an alias. + make_alias($file, "$FEISTY_MEOW_GENERATED/custom/scripts/"); + #print "added custom script file: $FEISTY_MEOW_GENERATED/custom/scripts/$file\n"; } else { # if it's a regular file, we'll try to make an alias for it. the function # will only fire if the ending is appropriate for the script languages we use. -- 2.34.1