Commit 10aa4374 authored by isaagar's avatar isaagar

Add package checker scripts

parent d2008df8
Pipeline #414 skipped
base-files
choose-mirror
debian-installer-launcher
debootstrap
desktop-base
localechooser
mate-desktop-environment
mate-menu
mate-panel
rootskel-gtk
#!/bin/bash
SET_IT()
{
PKG_NAME=$PKG
UP_PKG="http://packages.debian.org/stretch/$PKG_NAME"
#UP_MIR="http://pack"
#UP_PKG_LINK="$UP_MIR/"$(echo $PKG_NAME | head -c 1)"$PKG_NAME"
#DOWN_MIR="http://devel.hamaralinux.org/hamara-sugam/pool/main"
DOWN_PKG="http://devel.hamaralinux.org/hamara-sugam/pool/main/""$(echo $PKG_NAME | head -c 1)"/$PKG_NAME/
echo -e "Package link in hamara repo : \n" $DOWN_PKG
#using w3m for fetching page content from upstream and getting version
UP_VER="$(w3m $UP_PKG | grep "Package: $PKG_NAME" | tr -dc '0-9' )"
echo "Upstream version : " $UP_VER
COUNT="$(echo "${#UP_VER}")"
#echo $COUNT
DOWN_VER="$(w3m -dump $DOWN_PKG | grep -oh "$PKG_NAME.*hamara.*\.dsc")"
if [ $? -eq 1 ]
then
echo "Package is not available at hamara repo"
# exit 0
else
DOWN_VER="$(echo $DOWN_VER | tr -dc '0-9' | head -c $COUNT)"
echo "Downstram version : "$DOWN_VER
fi
}
CHECK_IT(){
ARCH="$(w3m -dump https://tracker.debian.org/pkg/$PKG_NAME | grep "arch:")"
echo "Arch variable contains -> "$ARCH
if [ "$UP_VER" -eq "$DOWN_VER" ];then
echo -e "\n Package $PKG_NAME is sync with upstream "
# notify-send -u normal "Package $PKG_NAME is sync with upstream"
elif [ "$UP_VER" -gt "$DOWN_VER" ];then
echo " Package $PKG_NAME is old"
echo " Get the new version "
#Run the build job for package
BUILD_IT
fi
}
BUILD_IT()
{
#check arch of package
echo $ARCH | grep -q "any"
if [ $? -eq 0 ]
then
ARCH="amd64-i386"
else
ARCH="all"
fi
#Check if jar file is present
if ls jenkins-cli.jar > /dev/null 2>&1
then
java -jar jenkins-cli.jar -s http://81.187.108.82:8080/ build $PKG_NAME-$ARCH
else
echo -e "\n Jenkins JAR file is not present"
echo -e "\t #### Fetching JAR fie ####"
wget http://devel.hamaralinux.org:8080/jnlpJars/jenkins-cli.jar
#Start build again
BUILD_IT
fi
}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
while read PKG
#for i in base-files choose-mirror debootstrap desktop-base debian-installer-launcher localechooser mate-desktop-environment mate-menu mate-panel rootskel-gtk
do
echo -e "\n\t############## Checking pacakge $PKG ##############"
SET_IT
CHECK_IT
done < package_list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment