Commit 003ce990 authored by Joost van Baal-Ilić's avatar Joost van Baal-Ilić

from aangifte-ib-installer-0.8

parent b7e371cf
#!/bin/sh -e
# this file maintained using GNU Arch at
# http://mdcc.cx/arch/{archives}/2006-aangifte-ib
#
# Copyright (C) 2006, 2007 Joost van Baal
#
# This file is free software; you can redistribute it and/or modify it under
# the terms of the GNU GPL as published by the FSF; version 3 of the License,
# or any later version. You should have received a copy of the GNU GPL along
# with this file (see COPYING); if not, check
# http://www.gnu.org/copyleft/gpl.html.
#
for f in /etc/aangifte-ib-installer.conf /usr/local/etc/aangifte-ib-installer.conf $HOME/.aangifte-ib-installer.conf
do
test -f $f && . $f
done
# check wether sources are present; if not, call get-aangifte-ib
check_sources
if test -z "$DIFFDIR"
then
echo "No valid .diff.gz found"
fi
if test -z "$TARDIR"
then
echo "No valid .tar.gz found"
fi
if test -z "$TARDIR" -o -z "$DIFFDIR"
then
if test "$1" = "go"
then
echo "Please run get-aangifte-ib to fetch sources."
exit 1
elif ask_user "Do you want to fetch sources now? [Yn] " 0
then
exec get-aangifte-ib
else
echo "OK, you can run get-aangifte-ib later."
fi
fi
if test -f "$DIFFDIR/$DEBFILE"
then
echo "File $DIFFDIR/$DEBFILE already built. No need to rebuild."
else
# create build dir, copy sources to build dir
BUILDDIR=`mktemp -d` || exit 1
cd $BUILDDIR
cp $TARDIR/$TARFILE .
cp $DIFFDIR/$DIFFFILE .
echo "Preparing build of $DEBFILE in $BUILDDIR..."
# unpack, patch and build
tar zxf $TARFILE
cd ib200?/
zcat ../$DIFFFILE | patch -p1 --quiet
chmod a+x debian/rules
echo "Building $DEBFILE (if you won't get a message $DEBFILE is"
echo "ready, inspect the build log in $BUILDDIR/build.log to see"
echo "what went wrong)..."
dpkg-buildpackage -rfakeroot -b -uc >$BUILDDIR/build.log 2>&1
# clean up build dir
cp ../$DEBFILE $DIFFDIR
echo " ---------------"
echo "| $DIFFDIR/$DEBFILE ready, build log in $BUILDDIR/build.log."
echo " ---------------"
if test "$1" = "go"
then
rm -rf $BUILDDIR
elif ask_user "Do you want to keep build stuff in $BUILDDIR, e.g. for debugging? [Ny] " 1
then
echo "OK, keeping $BUILDDIR. You can remove it manually later."
else
rm -rf $BUILDDIR
fi
fi
test -d /tmp/aangifte-ib-installer/ || mkdir /tmp/aangifte-ib-installer/
cp $DIFFDIR/$DEBFILE /tmp/aangifte-ib-installer/
if test "$1" = "go"
then
# non-interactive mode, called from within dpkg
echo "Remember to run install-aangifte-ib later."
elif ask_user "Do you want to install the aangifte-ib package now? [Yn] " 0
then
exec install-aangifte-ib
else
echo "OK, you can run install-aangifte-ib later."
fi
.so man1/aangifte-ib-installer.1
#!/bin/sh
# this file maintained using GNU Arch at
# http://mdcc.cx/arch/{archives}/2006-aangifte-ib
#
# Copyright (C) 2006, 2007 Joost van Baal
#
# This file is free software; you can redistribute it and/or modify it under
# the terms of the GNU GPL as published by the FSF; version 3 of the License,
# or any later version. You should have received a copy of the GNU GPL along
# with this file (see COPYING); if not, check
# http://www.gnu.org/copyleft/gpl.html.
#
for f in /etc/aangifte-ib-installer.conf /usr/local/etc/aangifte-ib-installer.conf $HOME/.aangifte-ib-installer.conf
do
test -f $f && . $f
done
if test 0 = `id -u`
then
test -d /usr/src/aangifte-ib-installer || mkdir -p /usr/src/aangifte-ib-installer
cd /usr/src/aangifte-ib-installer
else
test -d $HOME/.aangifte-ib-installer || mkdir -p $HOME/.aangifte-ib-installer
cd $HOME/.aangifte-ib-installer
fi
# set TARDIR/DIFFDIR
check_sources
if test -n "$TARDIR"
then
echo "Found valid .tar.gz in $TARDIR, no need to download"
else
echo "Downloading $TARURL..."
wget --output-document=$TARFILE --quiet $TARURL
if echo "$MD5SUM_TAR" | md5sum -c --status
then
TARDIR=`pwd`
else
echo "Downloaded file $TARFILE seems corrupt. Giving up."
exit 1
fi
fi
if test -n "$DIFFDIR"
then
echo "Found valid .diff.gz in $DIFFDIR, no need to download"
else
# wget --recursive --accept diff.gz --level=1 --no-directories --no-parent \
# http://mdcc.cx/pub/aangifte-ib/
echo "Downloading http://mdcc.cx/pub/aangifte-ib/$DIFFFILE..."
wget --output-document=$DIFFFILE --quiet http://mdcc.cx/pub/aangifte-ib/$DIFFFILE
if echo "$MD5SUM_DIFF" | md5sum -c --status
then
DIFFDIR=`pwd`
else
echo "Downloaded file $DIFFFILE in `pwd` seems corrupt. Giving up."
exit 1
fi
fi
echo " ----------------------------"
echo "| $TARFILE verified and installed in $TARDIR."
echo "| $DIFFFILE verified and installed in $DIFFDIR."
echo " ----------------------------"
if test "$1" = "go"
then
exec build-aangifte-ib go
elif ask_user "Do you want to build the aangifte-ib package now? [Yn] " 0
then
exec build-aangifte-ib
else
echo "OK, you can run build-aangifte-ib later."
fi
.so man1/aangifte-ib-installer.1
#!/bin/sh -e
# this file maintained using GNU Arch at
# http://mdcc.cx/arch/{archives}/2006-aangifte-ib
#
# Copyright (C) 2006 Joost van Baal
#
# This file is free software; you can redistribute it and/or modify it under
# the terms of the GNU GPL as published by the FSF; version 3 of the License,
# or any later version. You should have received a copy of the GNU GPL along
# with this file (see COPYING); if not, check
# http://www.gnu.org/copyleft/gpl.html.
#
if [ 0 = `id -u` ]
then
dpkg -i /tmp/aangifte-ib-installer/aangifte-ib*_i386.deb
else
echo >&2 "This script needs to be run as root."
echo >&2 "Please try again, e.g. by calling this script as"
echo >&2 "'sudo install-aangifte-ib'."
exit 1
fi
.so man1/aangifte-ib-installer.1
.\" this file maintained using GNU Arch at
.\" http://mdcc.cx/arch/{archives}/2006-aangifte-ib
.\" Copyright (C) 2006 Joost van Baal
.\"
.\" This file is free software; you can redistribute it and/or modify it under
.\" the terms of the GNU GPL.
.\"
.\" See http://people.debian.org/~branden/talks/wtfm/ for hints
.\" on writing manpages.
.\"
.\" Headings for Manpages in Sections 1, 6, or 8
.\"
.\" NAME
.\" SYNOPSIS
.\" DESCRIPTION
.\" OPTIONS
.\" EXAMPLES
.\" EXIT STATUS
.\" INPUT FILES (if used)
.\" OUTPUT FILES (if used)
.\" DIAGNOSTICS (if any)
.\" ASYNCHRONOUS EVENTS (if handlers defined)
.\" CONSEQUENCES OF ERRORS (if unusual)
.\" AUTHOR or AUTHORS
.\" SEE ALSO
.\"
.\"
.\" URL - macro for URLs
.\" The first argument is the URL, the second is the text to be
.\" hyperlinked, and the third (optional) argument is any text that
.\" needs to immediately trail the hyperlink without intervening
.\" whitespace.
.\"
.de URL
\\$2 \(laURL: \\$1 \(ra\\$3
..
.if \n[.g] .mso www.tmac
.TH aangifte-ib-installer 1 2007-07-11 "aangifte-ib-installer 0.7"
.SH NAME
aangifte-ib-installer \- get, build and install aangifte-ib
.
.SH SYNOPSIS
.BR "get\-aangifte\-ib " [ "go" ]
.br
.BR "build\-aangifte\-ib " [ "go" ]
.br
.B install\-aangifte\-ib
.SH DESCRIPTION
.TP
.I get\-aangifte\-ib
\fBget\-aangifte\-ib\fR downloads and verifies aangifte\-ib sources.
.PP
.TP
.I build\-aangifte\-ib
\fBbuild\-aangifte\-ib\fR builds the aangifte\-ib package from its
sources.
.PP
.TP
.I install\-aangifte\-ib
\fBinstall\-aangifte\-ib\fR installs the built aangifte\-ib package,
using the native package installer. Unlike the other two scripts,
this script needs to be run as root.
.PP
All three scripts are pretty verbose. The scripts \fBget\-aangifte\-ib\fR and
\fBbuild\-aangifte\-ib\fR are interactive (but see below).
.SH OPTIONS
When \fBget\-aangifte\-ib\fR or \fBbuild\-aangifte\-ib\fR are passed
the argument \fBgo\fR, they run in non-interactive
mode. This is useful when calling these scripts from within
a package installer.
.SH FILES
The scripts install files, and search for files in
.IR "$HOME/.aangifte-ib-installer/ " "and " "/usr/src/aangifte-ib-installer/" "."
The \fBinstall\-aangifte\-ib\fR script searches for the binary package in
.IR "/tmp/aangifte-ib-installer" "."
The scripts are configured using
.IR "/etc/aangifte-ib-installer.conf " "and " "$HOME/.aangifte-ib-installer.conf" "."
.SH AUTHOR
Copyright \(co 2006 Joost van Baal
.br
This document is free software; you can redistribute it and/or modify it under
the terms of the GNU GPL as published by the FSF; version 3 of the License,
or any later version. You should have received a copy of the GNU GPL along
with this file (see COPYING); if not, check
.URL "http://www.gnu.org/copyleft/gpl.html" "the copy on the FSF website" "."
.SH SEE ALSO
The
.URL "http://mdcc.cx/aangifte-ib" "aangifte-ib website" "."
#
# aangifte-ib-installer.conf - configuration and other shared stuff
# for the aangifte-ib-installer scripts
#
# TARFILE=ib2006_linux.tar.gz
TARFILE=ib2007_linux.tar.gz
# http://www.pvcf.nl/easytax/source/ ib2007_linux.tar.gz was released 12 juni 2007
# TARURL=http://www.pvcf.nl/easytax/source/$TARFILE
TARURL=http://download.belastingdienst.nl/belastingdienst/apps/linux/$TARFILE
# official version:
# http://www.belastingdienst.nl/download/ links to
# http://www.belastingdienst.nl/download/1706.html links to
# http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2007_linux.tar.gz released 2008-02-07
# DIFFFILE=aangifte-ib_0.2007-0.0.test.2007.06.12-1.diff.gz
DIFFFILE=aangifte-ib_0.2007-1.0.official.2008.02.07-1.diff.gz
# DEBFILE=aangifte-ib_0.2007-0.0.test.2007.06.12-1_i386.deb
DEBFILE=aangifte-ib_0.2007-1.0.official.2008.02.07-1_i386.deb
MD5SUM_TAR="90b3e1e8bd922c9061dc8bf237d489d3 $TARFILE"
MD5SUM_DIFF="4c5f90585825a208de007991f6776154 $DIFFFILE"
# don't change anything below this line (unless you really know what you
# are doing, of course)
# check_sources - set TARDIR and DIFFDIR if corresponding source found and
# checksum matches
check_sources() {
TARDIR=
DIFFDIR=
for d in $HOME/.aangifte-ib-installer /usr/src/aangifte-ib-installer /usr/local/src/aangifte-ib-installer
do
if test -d $d
then
cd $d
echo "$MD5SUM_TAR" | md5sum -c --status 2> /dev/null && TARDIR=$d
echo "$MD5SUM_DIFF" | md5sum -c --status 2> /dev/null && DIFFDIR=$d
cd - > /dev/null
fi
done
}
# ask_user --- function prompts the user with y/n style prompt
#
# taken from:
#
# build-<package>
#
# $ Id : build-PACKAGE,v 1.5 1998/05/01 08:35:36 phil Exp $
#
# Written by Philip Hands <phil@hands.com>
# Copyright (C) 1998 Free Software Foundation, Inc.
# Copying: GPL
# It's behaviour is controlled via the parameters:
# 1 - the initial prompt
# 2 - default return value (set to 0, 1 or "none")
# 3 - the patern match for acceptable Yes responses
# 4 - the patern match for acceptable No responses
# 5 - the error prompt, displayed when the user fails to provide valid input
#
# e.g. ask_user "Foo, or Bar [fb] " none '[fF]*' '[bB]*' "try again"
ask_user() {
P=${1:-'Should I do this ? [yN] '}
D=${2:-1}
Y=${3:-'[yY]*'}
N=${4:-'[nN]*'}
E=${5:-'\nPlease enter either y)es or n)o, followed by <RETURN>\n'}
while true ; do
/bin/echo -ne "$P"
read response
case "$response" in
${Y} ) return 0 ;;
${N} ) return 1 ;;
"" ) [ "$D" = 0 -o "$D" = 1 ] && return $D ;;
esac
/bin/echo -e $E
done
}
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