summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2017-07-23 13:59:13 -0400
committerB Stack <bgstack15@gmail.com>2017-07-23 13:59:13 -0400
commit166218ef319665ba76ca3f34652322c3cf1369bb (patch)
treedc9cc397502392336c6bf2ca00fd90a58e674808
parentFixed deb repo html guide to have correct pathname for (diff)
downloadmirror-166218ef319665ba76ca3f34652322c3cf1369bb.tar.gz
mirror-166218ef319665ba76ca3f34652322c3cf1369bb.tar.bz2
mirror-166218ef319665ba76ca3f34652322c3cf1369bb.zip
Fixed update.sh scripts to chown files, and have similar syntax
-rw-r--r--usr/share/doc/mirror/README.txt1
-rwxr-xr-xusr/share/mirror/examples/deb/update-smith122deb.sh21
-rwxr-xr-xusr/share/mirror/examples/rpm/update-smith122rpm.sh14
-rwxr-xr-xusr/share/mirror/examples/tar/update-smith122tar.sh18
4 files changed, 38 insertions, 16 deletions
diff --git a/usr/share/doc/mirror/README.txt b/usr/share/doc/mirror/README.txt
index 69033e2..14c65e7 100644
--- a/usr/share/doc/mirror/README.txt
+++ b/usr/share/doc/mirror/README.txt
@@ -136,3 +136,4 @@ Changed deploy.conf to use package directories for deployment
- Fixed deb source Date: format.
- Added update-tar example script.
- Fixed deb repo html guide to have correct pathname for /etc/apt/sources.list.d/.
+- Fixed update-{deb,rpm,tar} scripts to match syntax, and chown files.
diff --git a/usr/share/mirror/examples/deb/update-smith122deb.sh b/usr/share/mirror/examples/deb/update-smith122deb.sh
index 5ccf430..03f5726 100755
--- a/usr/share/mirror/examples/deb/update-smith122deb.sh
+++ b/usr/share/mirror/examples/deb/update-smith122deb.sh
@@ -1,19 +1,24 @@
#!/bin/sh
+# update-deb.sh
-# working directory
+# Prepare directory and files
repodir=/mnt/public/www/smith122/repo/deb/
-cd ${repodir}
-chmod 0644 *deb 1>/dev/null 2>&1
+ownership="apache:admins"
+filetypes="deb"
+find "${repodir}" -exec chown "${ownership}" {} + 1>/dev/null 2>&1
+find "${repodir}" -type f -exec chmod "0644" {} + 1>/dev/null 2>&1
+find "${repodir}" -type d -exec chmod "0755" {} + 1>/dev/null 2>&1
+chmod 0754 "$0"
restorecon -RF "${repodir}"
-# create the package index
+# Prepare repo for deb
+cd "${repodir}"
dpkg-scanpackages -m . > Packages
-cat Packages | gzip -9c > Packages.gz
+gzip -9c < Packages > Packages.gz
# create the Release file
-#Date: $(date -R)
-PKGS=$(wc -c Packages)
-PKGS_GZ=$(wc -c Packages.gz)
+PKGS="$(wc -c Packages)"
+PKGS_GZ="$(wc -c Packages.gz)"
cat <<EOF > Release
Architectures: all
Date: $(date -u '+%a, %d %b %Y %T %Z')
diff --git a/usr/share/mirror/examples/rpm/update-smith122rpm.sh b/usr/share/mirror/examples/rpm/update-smith122rpm.sh
index eea1d79..0a91952 100755
--- a/usr/share/mirror/examples/rpm/update-smith122rpm.sh
+++ b/usr/share/mirror/examples/rpm/update-smith122rpm.sh
@@ -1,10 +1,16 @@
#!/bin/sh
+# update-rpm.sh
-# working directory
+# Prepare directory and files
repodir=/mnt/public/www/smith122/repo/rpm/
-cd ${repodir}
-chmod 0644 *rpm 1>/dev/null 2>&1
+ownership="apache:admins"
+filetypes="rpm"
+find "${repodir}" -exec chown "${ownership}" {} + 1>/dev/null 2>&1
+find "${repodir}" -type f -exec chmod "0644" {} + 1>/dev/null 2>&1
+find "${repodir}" -type d -exec chmod "0755" {} + 1>/dev/null 2>&1
+chmod 0754 "$0"
restorecon -RF "${repodir}"
-# create the package index
+# Prepare repo for rpm
+cd ${repodir}
createrepo .
diff --git a/usr/share/mirror/examples/tar/update-smith122tar.sh b/usr/share/mirror/examples/tar/update-smith122tar.sh
index 743ddcd..3cefe19 100755
--- a/usr/share/mirror/examples/tar/update-smith122tar.sh
+++ b/usr/share/mirror/examples/tar/update-smith122tar.sh
@@ -1,5 +1,15 @@
#!/bin/sh
-cd /mnt/public/www/smith122/repo/tar
-chown -R apache:apache .
-find . -type f -regextype grep \( -regex '.*\.tar' -o -regex '.*\.tgz' -o -regex '.*\.gz' \) -exec chmod '-x' {} \; ;
-chmod +x "$0"
+# update-tar.sh
+
+# Prepare directory and files
+repodir=/mnt/public/www/smith122/repo/tar/
+ownership="apache:admins"
+filetypes="tar"
+find "${repodir}" -exec chown "${ownership}" {} + 1>/dev/null 2>&1
+find "${repodir}" -type f -exec chmod "0644" {} + 1>/dev/null 2>&1
+find "${repodir}" -type d -exec chmod "0755" {} + 1>/dev/null 2>&1
+chmod 0754 "$0"
+restorecon -RF "${repodir}"
+
+# Prepare repo for tar
+cd "${repodir}"
bgstack15