summaryrefslogtreecommitdiffstats
path: root/make-repo
diff options
context:
space:
mode:
Diffstat (limited to 'make-repo')
-rwxr-xr-xmake-repo72
1 files changed, 72 insertions, 0 deletions
diff --git a/make-repo b/make-repo
new file mode 100755
index 0000000..b9e15ca
--- /dev/null
+++ b/make-repo
@@ -0,0 +1,72 @@
+#!/usr/bin/sh
+
+REPODIR=/var/www/lighttpd/repos/local
+SCANPATH=.build
+CLEAN=0
+
+while [ $# -gt 0 ]
+do
+ OPTION=$1
+ shift
+
+ case $OPTION in
+ -r|--repo-dir)
+ REPODIR=$1
+ shift
+ ;;
+
+ -c|--clean)
+ CLEAN=1
+ ;;
+
+ -p|--path)
+ SCANPATH=$1
+ shift
+ ;;
+
+ -h|--help)
+ echo "Create a local repository from the RPMs found in the scan-path.
+
+usage: $0 [ options ]
+
+options:
+ -r --repo-dir Specify output directory of created repository (default: $REPODIR)
+ -c --clean Clean repository before scanning path for files
+ -p --path Scan specified path for RPMs (default: $SCANPATH)
+
+ -h --help Show this help file"
+ exit 1
+ ;;
+ esac
+done
+
+if [ ! -d $REPODIR ]
+then
+ mkdir -p $REPODIR
+fi
+
+if [ ! -w $REPODIR ]
+then
+ echo "You don't have access to $REPODIR" >&2
+ exit 1
+fi
+
+if [ $CLEAN -eq 1 ]
+then
+ rm -rf $REPODIR/*
+fi
+
+find $SCANPATH \( -name '*.rpm' -a ! -path '*/.repo/*' \) -exec cp {} $REPODIR \;
+createrepo -o $REPODIR $REPODIR
+
+ls -lahR $REPODIR > $REPODIR/files.txt
+
+IPADDR=$(ifconfig em1 | grep 'inet ' | sed -e 's,^\s\+inet \([0-9.]\+\).*$,\1,')
+
+cat >$REPODIR/local.repo <<EOF
+[local]
+name=local
+baseurl=http://$IPADDR/repos/local
+enabled=1
+gpgcheck=0
+EOF