Simple publish script based on scp

This commit is contained in:
Sami Samhuri 2010-08-29 19:50:14 -07:00
parent 7cb5d54e08
commit e6833ab0ea

13
publish
View file

@ -5,10 +5,21 @@ bail() {
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
[[ "$PWD" = "/" ]] && bail "no .publish file found"
cd ..
done
subdir="${PWD#$orig_pwd}"
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