Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Install the git folder shell to restrict git to per user folder #6

Merged
merged 2 commits into from

2 participants

@gradus

This pull request will:

  1. provide the user a little extra feedback
  2. Add colors to cli if needed
  3. cp nodester/scripts/git-shell-enforce-directory to usr/local/bin and make it executable
@gradus

I apologize.
only the second commit was supposed to be in this pull request.
The first is in a separate pull request.

@chrismatthieu chrismatthieu merged commit 4b14b94 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 47 additions and 10 deletions.
  1. +25 −6 dependencies_verify.sh
  2. +22 −4 env_creation.sh
View
31 dependencies_verify.sh
@@ -61,8 +61,9 @@ done
# checking npm dependencies
declare -a npm_deps_not_ok
declare -a npm_deps_to_install
-npm_deps_to_install=()
npm_deps_not_ok=()
+npm_deps_to_install=()
+
for npm_mod in ${npm_modules_dependencies[@]}
do
npm_version=`npm --version 2>&1`
@@ -95,9 +96,8 @@ do
echo ;
new_len=$(( ${#npm_deps_not_ok[@]} + 1 ))
npm_deps_not_ok[$new_len]=$npm_mod
- new_install=$(( ${#npm_deps_to_install[@]} + 1 ))
- npm_deps_to_install[$new_install]=$npm_mod_to_install
-
+ new_install_len=$(( ${#npm_deps_to_install[@]} + 1 ))
+ npm_deps_to_install[$new_install_len]=$npm_mod_to_install
fi
done
# printing missing dependencies
@@ -126,13 +126,24 @@ then
echo -n "Would you like to install these dependencies globally? [type ${BLDYEL}yes${NOCOLR} to proceed]: "
read install_npm_modules
if [ "$install_npm_modules" == 'yes' ] ;
- then
+ then
+ declare -a npm_deps_met
+ npm_deps_met=()
for i in "${npm_deps_to_install[@]}"
do
echo -n "installing npm module ${BLDVIO}$i${NOCOLR}"
echo ;
sh -c "npm install $i -g"
echo ;
+ new_installed_len=$(( ${#npm_deps_met[@]} + 1 ))
+ npm_deps_met[$new_installed_len]=$i
+ echo
+ if [ "${#sys_deps_not_ok[@]}" -eq "0" ] && [ "${#npm_deps_not_ok[@]}" -eq "${#npm_deps_met[@]}" ] ;
+ then
+ echo ;
+ echo "All Nodester dependencies are now met"
+ echo "Now, please run ${BLDYEL}sudo ./env_creation.sh${NOCOLR} to create your nodester environment"
+ fi
done
echo ;
else
@@ -144,7 +155,6 @@ then
echo -n "$i "
done
echo
-
fi
fi
@@ -152,3 +162,12 @@ if [ "${#sys_deps_not_ok[@]}" -gt "0" ] || [ "${#npm_deps_not_ok[@]}" -gt "0" ]
then
exit 1
fi
+
+if [ "${#sys_deps_not_ok[@]}" -eq "0" ] && [ "${#npm_deps_not_ok[@]}" -eq "0" ] ;
+then
+ echo ;
+ echo "All Nodester dependencies are met"
+ echo "Now, please run ${BLDYEL}sudo ./env_creation.sh${NOCOLR} to create your nodester environment"
+ exit 1
+fi
+
View
26 env_creation.sh
@@ -17,11 +17,21 @@ NODESTER_GROUP="nodester"
# PASTE YOUR USER SSH KEY IN THE VAR BELOW
YOUR_PUB_KEY=""
+if ($use_color) ;
+then
+ BLDYEL=$(tput bold ; tput setaf 3)
+ BLDVIO=$(tput bold ; tput setaf 5)
+ BLDCYA=$(tput bold ; tput setaf 6)
+ BLDRED=$(tput bold ; tput setaf 1)
+ BLDGRN=$(tput bold ; tput setaf 2)
+ NOCOLR=$(tput sgr0)
+fi
+
whoami=`whoami`
system=`uname -s`
case $whoami in
root)
- echo "You're root! *pew pew*"
+ echo "You're root! *with great power comes great responsibility*"
case $system in
'Darwin')
@@ -54,12 +64,20 @@ case $whoami in
echo "Your OS is not supported yet.. please contact the dev staff" && exit 1
;;
esac
-
+ echo "cloning Nodester from https://github.com/nodester/nodester.git"
+ echo ;
sh -c "git clone https://github.com/nodester/nodester.git $NODESTER_HOME_DIR/nodester"
-
+ echo "Installing the git folder shell to restrict git to per user folders"
+ echo ;
+ echo "writing public key to $NODESTER_HOME_DIR/.ssh/authorized_keys"
+ echo ;
sh -c " mkdir -p $NODESTER_HOME_DIR/.ssh &&
echo $YOUR_PUB_KEY > $NODESTER_HOME_DIR/.ssh/authorized_keys &&
chmod -R 700 $NODESTER_HOME_DIR/.ssh &&
+ cd $NODESTER_HOME_DIR/nodester"
+ echo "Installing the git folder shell to restrict git to per user folders"
+ sh -c " cp $NODESTER_HOME_DIR/nodester/scripts/git-shell-enforce-directory /usr/local/bin &&
+ chmod +x /usr/local/bin/git-shell-enforce-directory &&
echo \"# nodester related rules
$NODESTER_USER ALL = NOPASSWD: $NODESTER_HOME_DIR/nodester/proxy/start_proxy.sh *
$NODESTER_USER ALL = NOPASSWD: $NODESTER_HOME_DIR/nodester/proxy/stop.sh
@@ -71,5 +89,5 @@ $NODESTER_USER ALL = NOPASSWD: $NODESTER_HOME_DIR/nodester/scripts/launch_app.sh
echo "Dude, You ain't root :("
;;
esac
-
+
exit 0
Something went wrong with that request. Please try again.