From 6a33e9843086ab120912fe5bb0213c7bd31a2368 Mon Sep 17 00:00:00 2001 From: Sylvain Pineau Date: Tue, 14 Jul 2020 13:26:37 +0200 Subject: bin:sources_test -> sources_test.sh --- bin/sources_test | 28 ---------------------------- bin/sources_test.sh | 28 ++++++++++++++++++++++++++++ units/miscellanea/jobs.pxu | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) delete mode 100755 bin/sources_test create mode 100755 bin/sources_test.sh diff --git a/bin/sources_test b/bin/sources_test deleted file mode 100755 index a63c5b9..0000000 --- a/bin/sources_test +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -result=0 - -sources_list=$1 -repositories=$2 - -if [ -z "$sources_list" ]; then - echo "Must provide sources list location, e.g. /etc/apt/sources.list" - exit 1 -fi - -if [ -z "$repositories" ]; then - echo "Must provide list of repositories to check for, e.g. 'deb http://gb.archive.ubuntu.com/ubuntu/ precise multiverse, deb http://gb.archive.ubuntu.com/ubuntu/ precise-updates multiverse'" - exit 1 -fi - -IFS=$',' -for repository in $repositories; do - if grep -q "$repository" "$sources_list"; then - echo "$repository found in $sources_list" - else - echo "$repository not found in $sources_list" - result=1 - fi -done - -exit $result diff --git a/bin/sources_test.sh b/bin/sources_test.sh new file mode 100755 index 0000000..a63c5b9 --- /dev/null +++ b/bin/sources_test.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +result=0 + +sources_list=$1 +repositories=$2 + +if [ -z "$sources_list" ]; then + echo "Must provide sources list location, e.g. /etc/apt/sources.list" + exit 1 +fi + +if [ -z "$repositories" ]; then + echo "Must provide list of repositories to check for, e.g. 'deb http://gb.archive.ubuntu.com/ubuntu/ precise multiverse, deb http://gb.archive.ubuntu.com/ubuntu/ precise-updates multiverse'" + exit 1 +fi + +IFS=$',' +for repository in $repositories; do + if grep -q "$repository" "$sources_list"; then + echo "$repository found in $sources_list" + else + echo "$repository not found in $sources_list" + result=1 + fi +done + +exit $result diff --git a/units/miscellanea/jobs.pxu b/units/miscellanea/jobs.pxu index 6c98181..4f337ba 100644 --- a/units/miscellanea/jobs.pxu +++ b/units/miscellanea/jobs.pxu @@ -271,7 +271,7 @@ _description: plugin: shell category_id: com.canonical.plainbox::miscellanea id: miscellanea/sources-list -command: sources_test $SOURCES_LIST "$REPOSITORIES" +command: sources_test.sh $SOURCES_LIST "$REPOSITORIES" _description: Checks that a specified sources list file contains the requested repositories unit: template -- cgit v1.2.3