diff options
Diffstat (limited to 'tools/sync-conf.sh')
-rw-r--r-- | tools/sync-conf.sh | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/sync-conf.sh b/tools/sync-conf.sh index 6b1a934..561b993 100644 --- a/tools/sync-conf.sh +++ b/tools/sync-conf.sh @@ -1,6 +1,7 @@ #!/bin/bash dir="/var/tmp/portage/config/conf/$(hostname)" +username="ctibor" root=/ repo="ssh://git@git.brancik.cz/rpi-config.git" @@ -13,25 +14,25 @@ function check_repo { if [ ! -d /var/tmp/portage/config/.git ]; then echo "Cloning repository with config files." mkdir -p /var/tmp/portage - chown ctibor:ctibor /var/tmp/portage - /bin/su ctibor --command="/usr/bin/git clone --depth=1 ${repo} /var/tmp/portage/config" + chown ${username}:${username} /var/tmp/portage + /bin/su ${username} --command="/usr/bin/git clone --depth=1 ${repo} /var/tmp/portage/config" fi } case $1 in push) check_repo - /bin/su ctibor --command="/usr/bin/git pull" + /bin/su ${username} --command="/usr/bin/git pull" echo "Pushing config files to overlay folder ..." /usr/bin/rsync -v --files-from /etc/portage/filelist_sync --recursive ${root} ${dir} -- cd ${dir} - /bin/su ctibor --command="/usr/bin/git add ." - /bin/su ctibor --command="/usr/bin/git commit -a -m \"Update portage config for mizar $(date +%Y%m%d-%H%M%S)\"" - /bin/su ctibor --command="/usr/bin/git push";; + /bin/su ${username} --command="/usr/bin/git add ." + /bin/su ${username} --command="/usr/bin/git commit -a -m \"Update portage config for mizar $(date +%Y%m%d-%H%M%S)\"" + /bin/su ${username} --command="/usr/bin/git push";; pull) check_repo cd ${dir} - /bin/su ctibor --command="/usr/bin/git pull" + /bin/su ${username} --command="/usr/bin/git pull" echo "Pulling config files from overlay folder ..." /usr/bin/rsync -v --files-from /etc/portage/filelist_sync --recursive ${dir} ${root} --;; *) |