Added s3 media synchronizer
This commit is contained in:
parent
103b4a8d34
commit
72d6e76602
48
bin/aws/s3/sync-media
Executable file
48
bin/aws/s3/sync-media
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
source "$HOME/.config/wryn/env/env.zsh"
|
||||||
|
source $ZSH_COLOR_UTIL
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
pull ) PULL=1 ;;
|
||||||
|
push ) PUSH=1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ ! $PULL ] && [ ! $PUSH ] && FATAL 'must specify "pull" or "push"'
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
PULL_MEDIA() {
|
||||||
|
local TARGET="$1"
|
||||||
|
local REMOTE_TARGET="s3://$S3_SYNC_BUCKET/$1"
|
||||||
|
local LOCAL_TARGET="$HOME/$1"
|
||||||
|
|
||||||
|
[ ! -d $LOCAL_TARGET ] && mkdir -p $LOCAL_TARGET
|
||||||
|
|
||||||
|
CHECK "updating $1"
|
||||||
|
aws --profile $DOTWRYN_AWS_PROFILE \
|
||||||
|
s3 sync $REMOTE_TARGET $LOCAL_TARGET \
|
||||||
|
>/dev/null 2>&1 \
|
||||||
|
&& OK || WARN
|
||||||
|
}
|
||||||
|
|
||||||
|
PUSH_MEDIA() {
|
||||||
|
local TARGET="$1"
|
||||||
|
local REMOTE_TARGET="s3://$S3_SYNC_BUCKET/$1"
|
||||||
|
local LOCAL_TARGET="$HOME/$1"
|
||||||
|
|
||||||
|
CHECK "updating $1"
|
||||||
|
aws --profile $DOTWRYN_AWS_PROFILE \
|
||||||
|
s3 sync $LOCAL_TARGET $REMOTE_TARGET \
|
||||||
|
--delete \
|
||||||
|
>/dev/null 2>&1 \
|
||||||
|
&& OK || WARN
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for m in $S3_SYNC_MEDIA
|
||||||
|
do
|
||||||
|
[ $PULL ] && PULL_MEDIA $m
|
||||||
|
[ $PUSH ] && PUSH_MEDIA $m
|
||||||
|
done
|
14
env/env.zsh
vendored
14
env/env.zsh
vendored
@ -23,6 +23,20 @@ WEBBROWSER='google-chrome-stable'
|
|||||||
#I3__DMENU_FONT_SIZE=
|
#I3__DMENU_FONT_SIZE=
|
||||||
#I3__BORDER_PIXEL_SIZE=
|
#I3__BORDER_PIXEL_SIZE=
|
||||||
|
|
||||||
|
S3_SYNC_AWS_PROFILE='yage'
|
||||||
|
S3_SYNC_BUCKET='yage'
|
||||||
|
S3_SYNC_MEDIA=(
|
||||||
|
"Games/roms"
|
||||||
|
"Games/wrynscape"
|
||||||
|
"Media/sfx"
|
||||||
|
"Pictures/bg"
|
||||||
|
"Pictures/bg-archives"
|
||||||
|
"Pictures/custom-emoji"
|
||||||
|
"Pictures/jest"
|
||||||
|
"Pictures/profile"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
PS1_BRANCH_SYMBOL=''
|
PS1_BRANCH_SYMBOL=''
|
||||||
PS1_INDICATOR_SYMBOL='☕'
|
PS1_INDICATOR_SYMBOL='☕'
|
||||||
PS1_SEPARATOR='::'
|
PS1_SEPARATOR='::'
|
||||||
|
Loading…
Reference in New Issue
Block a user