Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Script to clone / update GITs according to a text-file
- # and build Debian-Packages from them as well as sort them into the repository
- # 2014-10-08 V1 by Michael Mrozek (EvilDragon)
- #
- # Setup some Env-Vars
- builddir="/srv/www/vhosts/domains/packages.pyra-handheld.com/build"
- gitlist="/srv/www/vhosts/domains/packages.pyra-handheld.com/build/packages.txt"
- repodir="/srv/www/vhosts/domains/packages.pyra-handheld.com/httpdocs/debian"
- logdir="/srv/www/vhosts/domains/packages.pyra-handheld.com/httpdocs/buildlogs"
- # Update rootfs if needed
- ARCH=armhf DIST=testing git-pbuilder update
- # Package-Build-Loop
- while read file
- do
- url="$(echo $file)"
- # Clean old stuff
- rm -R "$builddir/tmp/"
- build=false
- # Read the GIT URL
- gitdir="$(echo ${url%.*} | awk -F'/' '{print $NF}')"
- # Does GIT exist?
- if [ ! -d "$builddir/$gitdir" ]; then
- # Clone it!
- echo New Package! - Cloning $url
- gbp-clone $url
- build=true
- else
- # Otherwise: Update the GIT.
- echo Update GIT
- cd "$builddir/$gitdir"
- git fetch
- # Check if the package needs to be rebuilt
- update="$(gbp-pull | grep "up to date")"
- if [ -n "$update" ]; then
- build=false
- else
- build=true
- fi
- fi
- # Build if Package is updated
- if [ "$build" == true ]; then
- # Get package name
- package="$(head -1 "${builddir}/${gitdir}/debian/control" | awk '{print $NF}')"
- # Build the source and binary packages!
- cd "$builddir/$gitdir"
- git-buildpackage
- # Put it into the repository
- cd "$builddir/tmp"
- name="$(ls *.changes)"
- reprepro -V -b "$repodir" include jessie-pyra $name
- # Move the build log files into the build-log-dir
- mv "$builddir/tmp/*.build" "$logdir/"
- fi
- done <$gitlist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement