Skip to content

Commit acde42e

Browse files
Squiddimjon4hz
andauthored
feat: add toggle to keep source File Permissions (#51)
* feat: add toggle to keep source File Permissions Co-authored-by: Jonah <me@jon4hz.io>
1 parent 0385691 commit acde42e

5 files changed

Lines changed: 6 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ repo_mirror_repos: []
105105
# systemd_timer_calendar: "*-*-* 0/2:23:00"
106106
# systemd_timer_disabled: true # does not enable the timer (e.g. will not be started on boot), default false
107107
# systemd_unit_max_runtime_sec: 600 # 10 minutes, default 43200
108+
# keepPermissions: true # default false, when true skips --chmod=u=rwX,go=rX to preserve source permissions
108109
#
109110
# - name: archlinux
110111
# source_repo: rsync://mirror.23media.de/archlinux

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ repo_mirror_repos: []
8181
# systemd_timer_calendar: "*-*-* 0/2:23:00"
8282
# systemd_timer_disabled: true # does not enable the timer (e.g. will not be started on boot), default false
8383
# systemd_unit_max_runtime_sec: 600 # 10 minutes, default 43200
84+
# keepPermissions: true # default false, when true skips --chmod=u=rwX,go=rX to preserve source permissions
8485
#
8586
# - name: archlinux
8687
# source_repo: rsync://mirror.23media.de/archlinux

templates/usr/local/bin/rsync_debian_mirror.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ trace=project/trace/{{ repo_mirror_fqdn | quote }}
2828
master_trace="$base_path/project/trace/master"
2929

3030
# default rsync options
31-
rsync_opts="--bwlimit=${bwlimit} --timeout=600 --verbose --log-file="${log_file}" --perms --chmod=u=rwX,go=rX --no-motd --human-readable --recursive --hard-links --links --safe-links --times --delay-updates --temp-dir="${tmp_path}" --exclude={{ repo_mirror_fqdn }}"
31+
rsync_opts="--bwlimit=${bwlimit} --timeout=600 --verbose --log-file="${log_file}" --perms{% if item.keepPermissions|default(false) != true %} --chmod=u=rwX,go=rX{% endif %} --no-motd --human-readable --recursive --hard-links --links --safe-links --times --delay-updates --temp-dir="${tmp_path}" --exclude={{ repo_mirror_fqdn }}"
3232
stage1_rsync_opts="--exclude=Packages* --exclude=Sources* --exclude=Release* --exclude=InRelease --exclude=i18n/* --exclude=ls-lR*"
3333
stage2_rsync_opts="--max-delete=40000 --delay-updates --delete --delete-excluded"
3434

templates/usr/local/bin/rsync_single_mirror.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fi
7777
# start to rsync the mirror
7878
log-message 0 "Started $repo_name mirror rsync job."
7979
rsync --verbose --log-file="${log}" --no-motd --human-readable --recursive \
80-
--hard-links --links --safe-links --times --perms --chmod=u=rwX,go=rX \
80+
--hard-links --links --safe-links --times --perms{% if item.keepPermissions|default(false) != true %} --chmod=u=rwX,go=rX{% endif %} \
8181
--delete-during --temp-dir="${tmp_path}" {% if item.rsync_excludes is defined %}{% for i in item.rsync_excludes %}--exclude "{{ i }}" {% endfor %}{% endif %} \
8282
--bwlimit="${bwlimit}" --timeout="${rsync_timeout}" --contimeout=60 \
8383
"${repo_source}" \

templates/usr/local/bin/rsync_ubuntu_mirror.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ flock -n 9 || log-message 1 "$repo_name mirror rsync job is already running!" 1
6767
# start to rsync the mirror (stage 1)
6868
log-message 0 "Started stage 1 of $repo_name mirror rsync job."
6969
rsync --verbose --log-file="${log_file}" --no-motd --human-readable --recursive \
70-
--hard-links --links --safe-links --times --perms --chmod=u=rwX,go=rX \
70+
--hard-links --links --safe-links --times --perms{% if item.keepPermissions|default(false) != true %} --chmod=u=rwX,go=rX{% endif %} \
7171
--delay-updates --temp-dir="${tmp_path}" \
7272
--bwlimit="${bwlimit}" --timeout=120 --contimeout=60 \
7373
--exclude "Packages*" --exclude "Sources*" \
@@ -85,7 +85,7 @@ fi
8585
# start to rsync the mirror (stage 2)
8686
log-message 0 "Started stage 2 of $repo_name mirror rsync job."
8787
rsync --verbose --log-file="${log_file}" --no-motd --human-readable --recursive \
88-
--hard-links --links --safe-links --times --perms --chmod=u=rwX,go=rX \
88+
--hard-links --links --safe-links --times --perms{% if item.keepPermissions|default(false) != true %} --chmod=u=rwX,go=rX{% endif %} \
8989
--delete-during --temp-dir="${tmp_path}" \
9090
--bwlimit="${bwlimit}" --timeout=120 --contimeout=60 \
9191
"${repo_source}" \

0 commit comments

Comments
 (0)