#!/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 <