From 5f682f4a1a4b5d09713bafdc1a6ee56ca2fd9c7c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 11 Nov 2016 14:42:05 -0200 Subject: Change sync-tpc and sync-media-remotes params --- share/hydractl/sync-media-remotes | 14 +++++++------- share/hydractl/sync-tpc | 11 ++++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/share/hydractl/sync-media-remotes b/share/hydractl/sync-media-remotes index 0bff710..1805ac5 100755 --- a/share/hydractl/sync-media-remotes +++ b/share/hydractl/sync-media-remotes @@ -12,17 +12,17 @@ MEDIA="/var/cache/media" if [ -z "$DEST" ]; then echo "usage: $BASENAME " exit 1 -elif [ ! -d "$DEST/$MEDIA" ]; then - echo "folder $DEST/$MEDIA does not exist." +elif [ ! -d "$DEST" ]; then + echo "folder $DEST does not exist." exit 1 fi # Run for folder in `ls $MEDIA`; do - if [ -d "$DEST/$MEDIA/$folder/.git" ]; then + if [ -d "$DEST/$folder/.git" ]; then # Add new remotes git -C $MEDIA/$folder remote -v | while read remote; do - cd $DEST/$MEDIA/$folder + cd $DEST/$folder name="`echo $remote | cut -d ' ' -f 1`" addr="`echo $remote | cut -d ' ' -f 2`" type="`echo $remote | cut -d ' ' -f 3`" @@ -43,7 +43,7 @@ for folder in `ls $MEDIA`; do done # Delete old remotes - git -C $DEST/$MEDIA/$folder remote -v | while read remote; do + git -C $DEST/$folder remote -v | while read remote; do cd $MEDIA/$folder name="`echo $remote | cut -d ' ' -f 1`" addr="`echo $remote | cut -d ' ' -f 2`" @@ -59,8 +59,8 @@ for folder in `ls $MEDIA`; do if ! git remote -v | sed -e 's/\t/ /g' | grep -q "^$name $addr $type$"; then # Check if was not already removed by a previous command - if git -C $DEST/$MEDIA/$folder remote | grep -q "^$name$"; then - git -C $DEST/$MEDIA/$folder remote $command $name $arg + if git -C $DEST/$folder remote | grep -q "^$name$"; then + git -C $DEST/$folder remote $command $name $arg fi fi done diff --git a/share/hydractl/sync-tpc b/share/hydractl/sync-tpc index bdedf35..6186e98 100755 --- a/share/hydractl/sync-tpc +++ b/share/hydractl/sync-tpc @@ -5,12 +5,13 @@ # Parameters BASENAME="$0" -DEST="$1" -MEDIA="/var/cache/media" +TPC="$1" +DEST="/media/$1" +MEDIA="$DEST/var/cache/$TPC/media" # Syntax -if [ -z "$DEST" ]; then - echo "usage: $BASENAME " +if [ -z "$TPC" ]; then + echo "usage: $BASENAME " exit 1 elif [ ! -d "$DEST" ]; then echo "folder $DEST does not exist." @@ -43,4 +44,4 @@ $SUDO cp -a /etc/wicd/manager-settings.conf $DEST/etc/wicd/manager-set $SUDO cp -a /etc/udev/rules.d/70-persistent-net.rules $DEST/etc/udev/rules.d/70-persistent-net.rules # Sync media remotes -hydractl sync-media-remotes $DEST +hydractl sync-media-remotes $MEDIA -- cgit v1.2.3