Add howto. Fix spell error
authordennis <dennis@lists.indexdata.dk>
Wed, 28 Sep 2011 12:54:45 +0000 (14:54 +0200)
committerdennis <dennis@lists.indexdata.dk>
Wed, 28 Sep 2011 12:54:45 +0000 (14:54 +0200)
update-archive/HOWTO.txt [new file with mode: 0644]
update-archive/update-yum-archive.sh [new file with mode: 0755]
update-archive/update-yum-archve.sh [deleted file]

diff --git a/update-archive/HOWTO.txt b/update-archive/HOWTO.txt
new file mode 100644 (file)
index 0000000..69422ef
--- /dev/null
@@ -0,0 +1,4 @@
+ssh ftp.indexdata.dk
+cd ~/proj/git-tools/update-archive
+sudo su
+./update-archive.sh
\ No newline at end of file
diff --git a/update-archive/update-yum-archive.sh b/update-archive/update-yum-archive.sh
new file mode 100755 (executable)
index 0000000..9d49d26
--- /dev/null
@@ -0,0 +1,116 @@
+#!/bin/sh
+if [ "$(id -u)" != "0" -o $HOME != "/root" ]; then
+  echo "This script must be run as root (not sudo) to perform package singning." 1>&2
+  exit 1
+fi
+
+if test ! -f ~/.rpmmacros; then
+  echo "$0: Make sure ~/.rpmmacros file exsits and contains macros from git-tools/update-archive/root-rpmmacros"
+  exit 1
+fi
+
+if test ! -x /usr/bin/createrepo; then
+  echo "$0: /usr/bin/createrepo missing. Install createrepo"
+  exit 1
+fi
+
+if test ! -x /usr/bin/gpg; then
+  echo "$0: /usr/bin/gpg missing. Install gpg"
+  exit 1
+fi
+
+#check if root has rpm macros
+confdir=`pwd`
+pkgs_to_sign=""
+architectures="i386 x86_64"
+dirs_to_upd=""
+for vdist in centos/5.5 rhel/5.5; do
+  dist=`basename $vdist`
+  vendor=`dirname $vdist`
+  ftpdir=/home/ftp/pub/yum/$vendor/$dist
+  if test ! -d $ftpdir; then
+    echo "$ftpdir does not exist"
+    exit 1
+  fi
+  cd $ftpdir   
+  sections=""
+  for section in main restricted; do
+    # Prepare pool
+    d=$section
+    if test ! -d $d; then mkdir -p $d; fi
+    if test ! -d $d/SRPMS; then mkdir -p $d/SRPMS; fi
+    # Remove invalid symlinks (SRPMS, i386, x86_64,..)
+    for l in $d/SRPMS/*; do
+      if test -L "$l"; then
+        if test ! -f "$l"; then
+          rm $l
+        fi
+      fi
+    done
+    for arch in $architectures; do
+      dirs_to_upd="${dirs_to_upd} ${ftpdir}/${d}/${arch}"
+      for l in $d/$arch/Packages/*; do
+        if test -L "$l"; then
+          if test ! -f "$l"; then
+            rm $l
+          fi
+        fi
+      done
+    done
+    # Make symlinks from the regular FTP archive
+    has_packages=false
+    for pdir in /home/ftp/pub/*; do
+      use=false
+      if test -f $pdir/.htaccess -a $section != "main"; then
+        use=true
+      fi
+      if test ! -f $pdir/.htaccess -a $section = "main"; then
+        use=true
+      fi
+      if $use; then
+        distdir=$pdir/redhat/$vendor/$dist
+        if test -d $distdir; then
+          if test -d $distdir/SRPMS; then
+            for f in $distdir/SRPMS/*.src.rpm; do
+              if test -f $f; then                                                              
+                ln -sf $f $d/SRPMS/
+              fi
+            done
+          fi
+          for arch in $architectures; do
+            mkdir -p $d/${arch}/Packages
+            for f in $distdir/RPMS/${arch}/*.rpm $distdir/RPMS/noarch/*.rpm; do
+              if test -f $f; then
+                pkgs_to_sign="${pkgs_to_sign} $f"
+                ln -sf $f $d/${arch}/Packages/
+                has_packages=true
+              fi
+            done
+          done
+        fi
+      fi
+    done
+  done
+done
+echo "Signing pakages (default ID PPH is empty):"
+rpm --addsign ${pkgs_to_sign}
+chgrp staff ${pkgs_to_sign}
+chmod g+w ${pkgs_to_sign}
+echo "Updating repository meta:"
+for rdir in ${dirs_to_upd}; do
+  echo "Section ${rdir}"
+  if test -d $rdir && ls -A $rdir; then
+       createrepo --update ${rdir}
+       if test -f ${rdir}/repodata/repomd.xml.asc; then
+               rm ${rdir}/repodata/repomd.xml.asc
+       fi
+       gpg --detach-sign -u "Index Data" --armor ${rdir}/repodata/repomd.xml
+  else
+       echo "Empty."
+  fi
+done
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 8
+# End:
diff --git a/update-archive/update-yum-archve.sh b/update-archive/update-yum-archve.sh
deleted file mode 100755 (executable)
index 9d49d26..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/bin/sh
-if [ "$(id -u)" != "0" -o $HOME != "/root" ]; then
-  echo "This script must be run as root (not sudo) to perform package singning." 1>&2
-  exit 1
-fi
-
-if test ! -f ~/.rpmmacros; then
-  echo "$0: Make sure ~/.rpmmacros file exsits and contains macros from git-tools/update-archive/root-rpmmacros"
-  exit 1
-fi
-
-if test ! -x /usr/bin/createrepo; then
-  echo "$0: /usr/bin/createrepo missing. Install createrepo"
-  exit 1
-fi
-
-if test ! -x /usr/bin/gpg; then
-  echo "$0: /usr/bin/gpg missing. Install gpg"
-  exit 1
-fi
-
-#check if root has rpm macros
-confdir=`pwd`
-pkgs_to_sign=""
-architectures="i386 x86_64"
-dirs_to_upd=""
-for vdist in centos/5.5 rhel/5.5; do
-  dist=`basename $vdist`
-  vendor=`dirname $vdist`
-  ftpdir=/home/ftp/pub/yum/$vendor/$dist
-  if test ! -d $ftpdir; then
-    echo "$ftpdir does not exist"
-    exit 1
-  fi
-  cd $ftpdir   
-  sections=""
-  for section in main restricted; do
-    # Prepare pool
-    d=$section
-    if test ! -d $d; then mkdir -p $d; fi
-    if test ! -d $d/SRPMS; then mkdir -p $d/SRPMS; fi
-    # Remove invalid symlinks (SRPMS, i386, x86_64,..)
-    for l in $d/SRPMS/*; do
-      if test -L "$l"; then
-        if test ! -f "$l"; then
-          rm $l
-        fi
-      fi
-    done
-    for arch in $architectures; do
-      dirs_to_upd="${dirs_to_upd} ${ftpdir}/${d}/${arch}"
-      for l in $d/$arch/Packages/*; do
-        if test -L "$l"; then
-          if test ! -f "$l"; then
-            rm $l
-          fi
-        fi
-      done
-    done
-    # Make symlinks from the regular FTP archive
-    has_packages=false
-    for pdir in /home/ftp/pub/*; do
-      use=false
-      if test -f $pdir/.htaccess -a $section != "main"; then
-        use=true
-      fi
-      if test ! -f $pdir/.htaccess -a $section = "main"; then
-        use=true
-      fi
-      if $use; then
-        distdir=$pdir/redhat/$vendor/$dist
-        if test -d $distdir; then
-          if test -d $distdir/SRPMS; then
-            for f in $distdir/SRPMS/*.src.rpm; do
-              if test -f $f; then                                                              
-                ln -sf $f $d/SRPMS/
-              fi
-            done
-          fi
-          for arch in $architectures; do
-            mkdir -p $d/${arch}/Packages
-            for f in $distdir/RPMS/${arch}/*.rpm $distdir/RPMS/noarch/*.rpm; do
-              if test -f $f; then
-                pkgs_to_sign="${pkgs_to_sign} $f"
-                ln -sf $f $d/${arch}/Packages/
-                has_packages=true
-              fi
-            done
-          done
-        fi
-      fi
-    done
-  done
-done
-echo "Signing pakages (default ID PPH is empty):"
-rpm --addsign ${pkgs_to_sign}
-chgrp staff ${pkgs_to_sign}
-chmod g+w ${pkgs_to_sign}
-echo "Updating repository meta:"
-for rdir in ${dirs_to_upd}; do
-  echo "Section ${rdir}"
-  if test -d $rdir && ls -A $rdir; then
-       createrepo --update ${rdir}
-       if test -f ${rdir}/repodata/repomd.xml.asc; then
-               rm ${rdir}/repodata/repomd.xml.asc
-       fi
-       gpg --detach-sign -u "Index Data" --armor ${rdir}/repodata/repomd.xml
-  else
-       echo "Empty."
-  fi
-done
-# Local Variables:
-# mode:shell-script
-# sh-indentation: 2
-# sh-basic-offset: 8
-# End: