Commit 4773a21c authored by Philipp's avatar Philipp

(Re-)added golded patches and script

parent ff582364
#!/bin/bash
# Dependencies: texinfo devscripts libperl-dev quilt libncurses5-dev build-essential
printtitle() {
title=$1
if [ -z "$2" ]
then
chr="="
else
chr=$2
fi
num=$(( ${#title}+4 ))
v=$(printf "%-${num}s" "$chr")
echo "${v// /$chr}"
echo "$chr $title $chr"
echo "${v// /$chr}"
}
printhelp() {
echo "usage: $0 [<original-sources.tgz>] [<os version>]"
echo " eg: $0 gpsrc-115-20170303.tgz debian"
echo ""
echo "omit <os> for autodetection or set to override."
echo "Can be either \"debian\" or \"raspbian\" at the moment."
}
echo '*******************************************************'
echo '** Automatic creation tool for deb packages of husky **'
echo '*******************************************************'
echo ''
printtitle "Installing dependencies" "="
apt-get -y install texinfo devscripts libperl-dev quilt libncurses5-dev build-essential
if [ -z "$1" ]
then
printhelp
exit 1
fi
printtitle "System autodetection" "="
lsb=$( lsb_release -a 2>&1 )
if [ ! -z "$2" ]
then
os="$2"
elif [ $( echo "$lsb" |grep 'Distributor ID'| grep -c 'Rasbian' ) -gt 0 ]
then
os="raspbian"
elif [ $( echo "$lsb" |grep 'Distributor ID'| grep -c 'Debian' ) -gt 0 ]
then
os="debian"
else
printtitle "Could not autodetect os version" "!"
echo "You can pass it via commandline to override autodetection:"
printhelp
exit 1
fi
echo " - OS: ${os}"
osversion=$( echo "$lsb" |grep Codename |sed 's/Codename:\s\+\(.*\)/\1/' )
echo " - OS version: ${osversion}"
#if [ ! -e patches/${os}/goldedplus_1.1.5-2+nmu1~${osversion}1.patch1 ]
if [ ! -e patches/${os}/goldedplus_1.1.5-*~${osversion}?.patch1 ]
then
echo "Could not find patches for your os (version): ${os} ${osversion}"
echo "It's debian stretch only, at the moment. Sorry..."
exit 1
fi
echo ""
printtitle "Creating .orig.tar.gz files" "="
printtitle "Extracting upstream sources" "-"
tar -zxf "$1"
if [ -d "origs" ]
then
printtitle "Deleting old origs folder" "-"
rm -rf origs
fi
printtitle "Creating new origs folder" "-"
mkdir origs
printtitle "Moving and renaming original sources" "-"
cd origs
mv "../golded-plus/golded+" "./goldedplus_1.1.5"
printtitle "Applying 1st patch" "-"
patch -p0 <"../patches/${os}/goldedplus_1.1.5-2+nmu1~stretch1.patch1"
printtitle "Removing debian folder" "-"
rm -rf "goldedplus_1.1.5/debian"
printtitle "Building .orig.tar.gz files" "-"
tar -czf "goldedplus_1.1.5.orig.tar.gz" "goldedplus_1.1.5/"
cd ..
printtitle "Starting build" "="
printtitle "Creating new build folder" "-"
mkdir build
printtitle "Copying original source packages" "-"
cp origs/goldedplus*.orig.tar.gz build/
cd build
printtitle "Extracting original source packages" "-"
tar -zxf goldedplus*.orig.tar.gz
printtitle "Applying second patch" "-"
patch -p0 <"../patches/${os}/goldedplus_1.1.5-2+nmu1~stretch1.patch2"
printtitle "Building package" "-"
cd "goldedplus_1.1.5"
debuild -us -uc -sa
cd ../..
printtitle "Cleaning up" "="
if [ ! -d upload ]
then
printtitle "Creating upload folder" "-"
mkdir upload
fi
rm -rf golded-plus
printtitle "Moving packages to upload folder" "-"
rm -f build/*.orig.tar.gz
rm -rf build/*.orig
rm -rf build/goldedplus_1.1.5
mv build/* upload/
rm -rf build
printtitle "Finished" "="
This diff is collapsed.
This diff is collapsed.
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