diff options
| author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2024-06-10 17:16:35 +0200 |
|---|---|---|
| committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2024-06-10 18:32:07 +0200 |
| commit | ad77b5101ab196c71bd7907d1c71084a06ac7b64 (patch) | |
| tree | 4212afad419bec444b25ebd3deb07a52e5955b03 | |
| parent | e9c4d2e81382099decfad468bd89f67db55198d7 (diff) | |
| download | etc_apache2-ad77b5101ab196c71bd7907d1c71084a06ac7b64.tar.gz etc_apache2-ad77b5101ab196c71bd7907d1c71084a06ac7b64.tar.bz2 etc_apache2-ad77b5101ab196c71bd7907d1c71084a06ac7b64.zip | |
Add script to restore permissions of git repositories.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | restore-permissions.sh | 47 | ||||
| -rwxr-xr-x | sites-enabled/restore-permissions.sh | 42 |
3 files changed, 96 insertions, 1 deletions
@@ -58,6 +58,11 @@ apache2.tar.xz: apache2.tar install -o root -g root -m 755 -d /etc/gitolite3 install -o root -g root -m 644 $^ $@ +/srv/git/git-data/repositories/restore-permissions.sh: restore-permissions.sh + install -o root -g root -m 755 -d /srv/git/git-data/ + install -o git -g git -m 755 -d /srv/git/git-data/repositories + install -o git -g git -m 644 $^ $@ + EXTRA_ETC_CONFIG = \ /etc/cgit.d/contrib.conf \ /etc/cgit.d/infrastructure.conf \ @@ -65,7 +70,8 @@ EXTRA_ETC_CONFIG = \ /etc/cgit.d/replicant.conf \ /etc/cgit.d/replicant-next.conf \ /etc/gitconfig \ - /etc/gitolite3/gitolite.rc + /etc/gitolite3/gitolite.rc \ + /var/lib/gitolite3/repositories/restore-permissions.sh update: $(EXTRA_ETC_CONFIG) id www-data | grep 'groups=.*(git)' || gpasswd -a www-data git diff --git a/restore-permissions.sh b/restore-permissions.sh new file mode 100644 index 0000000..a237dea --- /dev/null +++ b/restore-permissions.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +set -e +set -x + +# This file comes from the following repository and is being updated +# along with the apache 2 configuration: +# https://git.replicant.us/infrastructure/etc_apache2 +# So don't manually modify it. + +topdirs="contrib infrastructure mirrors replicant replicant-next" + +for topdir in ${topdirs} ; do + chown git:git -R "${topdir}" + chmod 755 "${topdir}" +done + +for topdir in \ + contrib/*/*.git \ + contrib/GNUtoo/*/*.git \ + contrib/wizzard/Android/*.git \ + infrastructure/*.git \ + mirrors/*/*.git \ + replicant/*.git \ + replicant-next/*.git ; do + # We at least have some symlinks. + if [ ! -L "${topdir}" ] ; then + chown git:git -R "${topdir}" + chmod 755 "${topdir}" + find "${topdir}" -type d | xargs chmod 755 + find "${topdir}" -type f | xargs chmod 644 + fi +done diff --git a/sites-enabled/restore-permissions.sh b/sites-enabled/restore-permissions.sh new file mode 100755 index 0000000..8ab0777 --- /dev/null +++ b/sites-enabled/restore-permissions.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +set -e +set -x + +topdirs="contrib infrastructure mirrors replicant replicant-next" + +for topdir in ${topdirs} ; do + chown git:git -R "${topdir}" + chmod 755 "${topdir}" +done + +for topdir in \ + contrib/*/*.git \ + contrib/GNUtoo/*/*.git \ + contrib/wizzard/Android/*.git \ + infrastructure/*.git \ + mirrors/*/*.git \ + replicant/*.git \ + replicant-next/*.git ; do + # We at least have some symlinks. + if [ ! -L "${topdir}" ] ; then + chown git:git -R "${topdir}" + chmod 755 "${topdir}" + find "${topdir}" -type d | xargs chmod 755 + find "${topdir}" -type f | xargs chmod 644 + fi +done |
