From: Chris Koeritz Date: Mon, 26 Jan 2015 02:27:14 +0000 (-0500) Subject: fixed custom scripts issue, so now the custom folder for a user can have a "scripts... X-Git-Tag: 2.140.90~717 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=8581b6c87895dcc6445a270f42bdc9483ff28ed2;p=feisty_meow.git 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. --- diff --git a/customizing/fred/aliases/ssh.sh b/customizing/fred/aliases/ssh.sh deleted file mode 100755 index 064ecf8a..00000000 --- a/customizing/fred/aliases/ssh.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# wraps our calling the secure shell and lets us pick our credentials. - -source "$FEISTY_MEOW_SCRIPTS/security/pick_credentials.sh" - -if [ ! -z "$keyfile" ]; then - \ssh -i "$keyfile" -X $* -else - \ssh -X $* -fi - -if [ $? -eq 0 ]; then - # we don't want to emit anything extra if this is being driven by git. - if [ -z "$(echo $* | grep git)" ]; then - # re-run the terminal labeller after coming back from ssh. - # we check the exit value because we don't want to update this for a failed connection. - bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh - fi -fi - - diff --git a/customizing/fred/scripts/ssh.sh b/customizing/fred/scripts/ssh.sh new file mode 100755 index 00000000..2e1b3742 --- /dev/null +++ b/customizing/fred/scripts/ssh.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# wraps our calling the secure shell and lets us pick our credentials. + +source "$FEISTY_MEOW_SCRIPTS/security/pick_credentials.sh" + +if [ ! -z "$keyfile" ]; then + \ssh -i "$keyfile" -X -C -c blowfish-cbc $* +else + \ssh -X -C -c blowfish-cbc $* +fi + +if [ $? -eq 0 ]; then + # we don't want to emit anything extra if this is being driven by git. + if [ -z "$(echo $* | grep git)" ]; then + # re-run the terminal labeller after coming back from ssh. + # we check the exit value because we don't want to update this for a failed connection. + bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh + fi +fi + + 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.