Simple publish script based on scp
This commit is contained in:
parent
7cb5d54e08
commit
e6833ab0ea
1 changed files with 12 additions and 1 deletions
13
publish
13
publish
|
|
@ -5,10 +5,21 @@ bail() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[ "$PUBLISH_HOST" != "" ]] && [[ "$publish_host" = "" ]] && publish_host="$PUBLISH_HOST"
|
||||||
|
[[ "$PUBLISH_DIR" != "" ]] && [[ "$publish_dir" = "" ]] && publish_dir="$PUBLISH_DIR"
|
||||||
|
|
||||||
|
orig_pwd="$PWD"
|
||||||
while ! [[ -f .publish ]]; do
|
while ! [[ -f .publish ]]; do
|
||||||
[[ "$PWD" = "/" ]] && bail "no .publish file found"
|
[[ "$PWD" = "/" ]] && bail "no .publish file found"
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
subdir="${PWD#$orig_pwd}"
|
||||||
|
|
||||||
source .publish
|
source .publish
|
||||||
scp -r $1 $PUBLISH_HOST:$PUBLISH_DIR
|
cd "$orig_pwd"
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
scp -r * "$publish_host":"${publish_dir}${subdir}"
|
||||||
|
else
|
||||||
|
scp "$@" "$publish_host":"${publish_dir}${subdir}"
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue