Skip to content

Commit

Permalink
Added ssu-repos.sh tool that currently has option to cleanup /etc/zyp…
Browse files Browse the repository at this point in the history
…p/repos.d/ for repositories that are not included in any rpm packages.

Signed-off-by: Marko Saukko <marko.saukko@jollamobile.com>
  • Loading branch information
Marko Saukko committed Nov 27, 2012
1 parent 6e95fa5 commit 125078e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ssu.pro
Expand Up @@ -10,7 +10,7 @@ ssuconfhack {
SUBDIRS += ssuconfperm
}

SUBDIRS += tests
SUBDIRS += tests tools

rndssucli.depends = libssu
rndregisterui.depends = libssu
Expand Down
24 changes: 24 additions & 0 deletions tools/ssu-repos.sh
@@ -0,0 +1,24 @@
#!/bin/sh

function repo_clean {
REPO_DIR=/etc/zypp/repos.d/
TMP_DIR=${REPO_DIR}/old/

mkdir -p ${TMP_DIR}

for REPO_FILE in `ls -1 ${REPO_DIR}/*.repo`; do
rpm -qf ${REPO_FILE} &> /dev/null
if [ $? -eq 1 ]; then
echo "Moving ${REPO_FILE} to ${TMP_DIR}."
mv ${REPO_FILE} ${TMP_DIR}
fi
done
}

if [ $# -ne 1 -o "$1" != "clean" ]; then
echo "Usage: $0 clean"
exit 1
fi

repo_clean

7 changes: 7 additions & 0 deletions tools/tools.pro
@@ -0,0 +1,7 @@
TEMPLATE = subdirs

tools.files = ssu-repos.sh
tools.path = /usr/sbin/

INSTALLS += tools

0 comments on commit 125078e

Please sign in to comment.