Skip to content

Commit

Permalink
sudo request only can't write file to /usr/local/bin. thank for https…
Browse files Browse the repository at this point in the history
  • Loading branch information
fbzhong committed Oct 12, 2012
1 parent 238c8d5 commit 55c01c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
16 changes: 14 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ tar -xzf $dst
pushd $extract_dir 1>/dev/null

# copy bin.
sudo cp $src_bin/* "$dst_bin"
echo "installing git-gerrit to /usr/local/bin..."
if [ -w "$dst_bin" ]; then
cp $src_bin/* "$dst_bin"
else
echo "request sudo authorization to install git-gerrit to /usr/local/bin:"
sudo cp $src_bin/* "$dst_bin"
fi

if [ ! -d "$dst_completion" ] ; then
mkdir -p "$dst_completion"
fi

# copy bash-completion.
sudo cp $src_completion/* "$dst_completion"
if [ -w "$dst_completion" ]; then
cp $src_completion/* "$dst_completion"
else
echo "request sudo authorization to install git-gerrit to /usr/local/bin:"
sudo cp $src_completion/* "$dst_completion"
fi


popd 1>/dev/null

Expand Down
15 changes: 13 additions & 2 deletions install_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,24 @@ if [ "Darwin" = "$name" ] ; then
fi

# copy bin.
sudo cp $src_bin/* "$dst_bin"
echo "installing git-gerrit to /usr/local/bin..."
if [ -w "$dst_bin" ]; then
cp $src_bin/* "$dst_bin"
else
echo "request sudo authorization to install git-gerrit to /usr/local/bin:"
sudo cp $src_bin/* "$dst_bin"
fi

if [ ! -d "$dst_completion" ] ; then
mkdir -p "$dst_completion"
fi

# copy bash-completion.
sudo cp $src_completion/* "$dst_completion"
if [ -w "$dst_completion" ]; then
cp $src_completion/* "$dst_completion"
else
echo "request sudo authorization to install git-gerrit to /usr/local/bin:"
sudo cp $src_completion/* "$dst_completion"
fi

echo "git-gerrit install success."

0 comments on commit 55c01c4

Please sign in to comment.