-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command process to install globally exx
#1
base: master
Are you sure you want to change the base?
Changes from 6 commits
37493ea
9b37351
2bff27f
3eb3a33
23ada36
6c5d482
036af76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env sh | ||
# Usage: exx install | ||
# Summary: Install `exx` globally | ||
|
||
INSTALL_PATH=$HOME/.sub | ||
COPY_DIR=$true | ||
|
||
copy(){ | ||
CURRENT_PATH=`pwd` | ||
read -p "Do you wish install exx into $path ? (Y/n) : " yn | ||
|
||
case $yn in | ||
[Yy]*) | ||
cp -R $CURRENT_PATH $path; | ||
symlink; | ||
break;; | ||
[Nn]*) echo "non"; break;; | ||
*) echo "Please select Y/n" | ||
esac | ||
} | ||
|
||
symlink(){ | ||
BINARY_PATH="/usr/local/bin/exx" | ||
SOURCE_PATH=$path | ||
|
||
if [[ "$SOURCE_PATH" == */exx ]]; then | ||
SOURCE_PATH=$(dirname $path) | ||
fi | ||
|
||
if [ ! \( -e "${BINARY_PATH}" \) ]; then | ||
echo "Create symlinks into $BINARY_PATH" | ||
ln -s $SOURCE_PATH/exx/libexec/exx $BINARY_PATH | ||
echo "Done !" | ||
echo "Check vertification installation by running ``exx info`` for example" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why "vertification installation" ? |
||
fi | ||
} | ||
|
||
# test if installation path exists | ||
# if not, we create folder | ||
if [ ! -d $INSTALL_PATH ]; then | ||
mkdir $INSTALL_PATH | ||
fi | ||
|
||
# we ask the user installation path | ||
read -p "Path to install (default: $INSTALL_PATH) : " path | ||
|
||
if [ -z "$path" ]; then | ||
path=$INSTALL_PATH | ||
fi | ||
|
||
# if path is the current directory, don't copy | ||
if [ "$path" == "." ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove COPY_DIR variable |
||
path=`pwd` | ||
COPY_DIR=$false | ||
fi | ||
|
||
if [ "$path" == `pwd` ] && [ !$COPY_DIR ]; then | ||
symlink | ||
exit | ||
fi | ||
|
||
# we check if exx exists into path | ||
if [ ! -d "$path/exx" ]; then | ||
copy | ||
else | ||
echo "exx is already install into $path" | ||
symlink | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove else clause and call symlink everytime |
||
fi | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Advise the user to delete the current folder if $path != "." |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test if CURRENT_PATH is not equivalent to PATH_INSTALL