Skip to content

Commit

Permalink
Inital commit of fenbuild based off some previous scripts i made
Browse files Browse the repository at this point in the history
Fenbuild is a commandline tool for easily creating, setting up and using
pbuilder. The idea behind the tool is to direct a user through creating
a pbuilder environment so they can focus on packaging.

I've tried to model the command line interface similar to git in the sense
that some state is saved as to which environment you current have selected
which makes it easier when building for a particular environment or
multiple environments with the same package.
  • Loading branch information
Andrew Fenn committed Apr 29, 2015
1 parent 7005c16 commit b462ed6
Show file tree
Hide file tree
Showing 5 changed files with 800 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fendeb-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e

if [ -z "$PROG" ]; then
source fendeb.sh build $@
exit 0
fi

if [ $VERBOSE ]; then
echo "Creating $DISTRO $ $ARCH"
echo "pbuilder binary: $PBUILDER_BIN"
fi


required_checks
configure_path
set_working_builder
93 changes: 93 additions & 0 deletions fendeb-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash

set -e

if [ -z "$PROG" ]; then
source fendeb.sh create $@
exit 0
fi

if [ $VERBOSE ]; then
echo "Creating $DISTRO $ $ARCH"
echo "pbuilder binary: $PBUILDER_BIN"
fi


required_checks
configure_path
choose_distro
choose_mirror
choose_release
choose_arch

if [ $VERBOSE ]; then
echo "Creating new environment:"
echo "pbuilder binary: $PBUILDER_BIN"
echo "Distribution: $DISTRO"
echo "From Release: $RELEASE"
echo "With Components: $COMPONENTS"
echo "From Mirror: $MIRROR"
echo "From Architecture: $ARCH"
echo "Storage Path: $STORAGE_PATH"
fi


path="$STORAGE_PATH/$DISTRO/$RELEASE/$ARCH"
if [ $VERBOSE ]; then
echo "Creating directories for pbuilder at: $path"
fi

mkdir -p $path/
mkdir -p $path/hooks
mkdir -p $path/build
mkdir -p $path/logs
mkdir -p $path/cache
mkdir -p $path/result

if [ $VERBOSE ]; then
echo "Creating hook script to allow use of deb files that have been built already"
fi

echo "#!/bin/sh
(cd $path/result; apt-ftparchive packages . > Packages)
apt-get update" > $path/hooks/D10apt-ftparchive
chmod +x $path/hooks/D10apt-ftparchive

echo "OTHERMIRROR=\"deb file://$path/result ./\"
BINDMOUNTS=\"$path/result\"
HOOKDIR=\"$path/hooks\"
EXTRAPACKAGES=\"apt-utils\"
MIRRORSITE=\"$MIRROR\"
COMPONENTS=\"$COMPONENTS\"
" > $path/pbuilderrc


if [ $VERBOSE ]; then
echo "Creating build, cache and result folders for pbuilder"
fi

if [ $VERBOSE ]; then
echo "Initilising pbuilder to create new workspace"
fi

sudo pbuilder --create --basetgz $path/base.tar.gz \
--architecture $ARCH \
--mirror $MIRROR \
--buildplace $path/build \
--distribution $RELEASE \
--aptcache $path/cache \
--debootstrapopts --variant=buildd \
--buildresult $path/result \
--extrapackages apt-utils

if [ $? == 0 ]; then

path=`get_fendeb_path`
file="$path/available-builds"
echo "$DISTRO/$RELEASE/$ARCH" >> $file

echo -en $GREEN"Finished"$NO_COLOUR"\n"
echo "Your files will be built in: $path"
echo "Your deb files will be saved in: $path/result"
echo "Downloaded deb files will be saved in: $path/cache"
fi
56 changes: 56 additions & 0 deletions fendeb-make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -e

if [ -z "$PROG" ]; then
source fendeb.sh make $@
exit 0
fi

required_checks
configure_path
current=`get_working_builder`
if [ -z $current ]; then
echo "No build selected or can be found. Select one with: fendeb build"
exit 1
fi

IFS='/'
arr=($current)

DISTRO=${arr[0]}
RELEASE=${arr[1]}
ARCH=${arr[2]}

if [ $VERBOSE ]; then
echo "Making build with environment:"
echo "pbuilder binary: $PBUILDER_BIN"
echo "Distribution: $DISTRO"
echo "From Release: $RELEASE"
echo "From Architecture: $ARCH"
echo "Storage Path: $STORAGE_PATH"
fi

path="$STORAGE_PATH/$DISTRO/$RELEASE/$ARCH"
if [ $VERBOSE ]; then
echo "Building with pbuilder at: $path"
fi

exit

if [ -z $3 ]; then
echo "Must include dsc file"
exit 1
fi

set -u

sudo pbuilder --build --basetgz $path/base.tar.gz \
--architecture $ARCH \
--buildplace $path/build \
--distribution $DISTRO \
--aptcache $path/cache \
--buildresult $path/result \
--override-config \
--configfile $path/pbuilderrc \
--extrapackages apt-utils $3 2>&1 | tee $path/logs/$3.log
48 changes: 48 additions & 0 deletions fendeb-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -e

if [ -z "$PROG" ]; then
source fendeb.sh update $@
exit 0
fi


required_checks
configure_path
current=`get_working_builder`
if [ -z $current ]; then
echo "No build selected or can be found. Select one with: fendeb build"
exit 1
fi

IFS='/'
arr=($current)

DISTRO=${arr[0]}
RELEASE=${arr[1]}
ARCH=${arr[2]}

if [ $VERBOSE ]; then
echo "Making build with environment:"
echo "pbuilder binary: $PBUILDER_BIN"
echo "Distribution: $DISTRO"
echo "From Release: $RELEASE"
echo "From Architecture: $ARCH"
echo "Storage Path: $STORAGE_PATH"
fi

path="$STORAGE_PATH/$DISTRO/$RELEASE/$ARCH"
if [ $VERBOSE ]; then
echo "Updating with pbuilder at: $path"
fi

sudo pbuilder --update --basetgz $path/base.tar.gz \
--architecture $ARCH \
--buildplace $path/build \
--distribution $DISTRO \
--aptcache $path/cache \
--buildresult $path/result \
--override-config \
--configfile $path/pbuilderrc \
--extrapackages apt-utils
Loading

0 comments on commit b462ed6

Please sign in to comment.