postinst is in apt-build 0.12.42.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | #!/bin/sh
set -e
CONFFILE="/etc/apt/apt-build.conf"
# remove obsolete config file from apt-build <= 0.12.37
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null ; then
dpkg-maintscript-helper rm_conffile /etc/apt/sources.list.d/apt-build -- "$@"
fi
if [ "$1" = "configure" ] ; then
. /usr/share/debconf/confmodule
db_get apt-build/olevel
case "$RET" in
"Light")
Olevel="-O1"
;;
"Medium")
Olevel="-O2"
;;
"Strong")
Olevel="-O3"
;;
esac
db_get apt-build/build_dir
build_dir="$RET"
db_get apt-build/repository_dir
repository_dir="$RET"
db_get apt-build/add_to_sourceslist
add_to_sourceslist="$RET"
db_get apt-build/options
options="$RET"
db_get apt-build/make_options
make_options="$RET"
db_get apt-build/archtype
#march=-march="$RET"
mtune=-mtune="$RET"
# Create build_dir
if [ ! -e "$build_dir" ] ; then
mkdir -p "$build_dir"
fi
# Create repository_dir
if [ ! -e "$repository_dir" ] ; then
mkdir -p "$repository_dir"/dists/apt-build/main
ln -s ../../.. "$repository_dir"/dists/apt-build/main/binary-$(dpkg --print-architecture)
fi
# link release file for apt-build distribution (for upgrade from 0.12.41)
if [ ! -e "$repository_dir"/dists/apt-build/Release ] ; then
ln -s ../../Release "$repository_dir"/dists/apt-build/Release
fi
sed s/__arch__/$(dpkg --print-architecture)/ /usr/share/apt-build/Release > "$repository_dir/Release"
# prepare sources.list entry
eval $(apt-config shell etcdir Dir::Etc)
eval $(apt-config shell sourceslist Dir::Etc::sourcelist)
eval $(apt-config shell sourcesparts Dir::Etc::sourceparts)
sourceslist=/"$etcdir""$sourceslist"
sourcesparts=/"$etcdir""$sourcesparts"
aptbuildsource="$sourcesparts"/apt-build.list
debline="deb file:$repository_dir apt-build main"
src_enabled="false"
# run loop to prevent errors if some sources does not exist
for source in "$sourceslist" "$sourcesparts"/*.list ; do
if [ -e "$source" ] ; then
# comment in all sources lists if asked
if [ "$add_to_sourceslist" = "false" ] ; then
sed -i -e "s|^[:space:]*$debline.*|#$debline|" "$source"
# check if source entry is already enabled
elif grep -Eq "^[[:space:]]*$debline" "$source" ; then
src_enabled="true"
fi
fi
done
# do not modify anything if source entry is already enabled
if [ "$add_to_sourceslist" = "true" ] && [ $src_enabled = "false" ] ; then
if [ ! -e "$sourcesparts" ] ; then
mkdir -p "$sourcesparts"
fi
if [ ! -e "$aptbuildsource" ] ; then
echo "$debline" > "$aptbuildsource"
fi
if grep -q "$debline" "$aptbuildsource" ; then
# modify only first occurrence of $debline to prevent duplicate entries
sed -i -e "0,\|^.*$debline|s||$debline|" "$aptbuildsource"
else
echo "$debline" >> "$aptbuildsource"
fi
fi
# Remove one-byte Packages file created by old postinst
if [ -f $repository_dir/Packages.gz ] && [ $(zcat $repository_dir/Packages.gz | wc -c) -eq 1 ] ; then
rm -f $repository_dir/Packages.gz
fi
if [ ! -e "$repository_dir/Packages.gz" ] ; then
gzip -9 < /dev/null > "$repository_dir/Packages.gz"
fi
# Configuration options
# if config file does not exist
if [ ! -e $CONFFILE ] ; then
echo "build-dir =" > $CONFFILE
echo "repository-dir =" >> $CONFFILE
echo "Olevel =" >> $CONFFILE
#echo "march =" >> $CONFFILE
echo "mtune =" >> $CONFFILE
echo "options =" >> $CONFFILE
echo "make_options =" >> $CONFFILE
fi
cp -a -f $CONFFILE $CONFFILE.tmp
# (re)add deleted or commented variables
test -z "build-dir" || grep -Eq '^[[:space:]]*build-dir =' $CONFFILE || \
echo "build-dir =" >> $CONFFILE
test -z "repository-dir" || grep -Eq '^[[:space:]]*repository-dir =' $CONFFILE || \
echo "repository-dir =" >> $CONFFILE
test -z "Olevel" || grep -Eq '^[[:space:]]*Olevel =' $CONFFILE || \
echo "Olevel =" >> $CONFFILE
#test -z "march" || grep -Eq '^[[:space:]]*march =' $CONFFILE || \
# echo "march =" >> $CONFFILE
test -z "mtune" || grep -Eq '^[[:space:]]*mtune =' $CONFFILE || \
echo "mtune =" >> $CONFFILE
test -z "options" || grep -Eq '^[[:space:]]*options =' $CONFFILE || \
echo "options =" >> $CONFFILE
test -z "make_options" || grep -Eq '^[[:space:]]*make_options =' $CONFFILE || \
echo "make_options =" >> $CONFFILE
sed -e "s|^[:space:]*build-dir =.*|build-dir = $build_dir|" \
-e "s|^[:space:]*repository-dir =.*|repository-dir = $repository_dir|" \
-e "s|^[:space:]*Olevel =.*|Olevel = $Olevel|" \
-e "s|^[:space:]*mtune =.*|mtune = $mtune|" \
-e "s|^[:space:]*options =.*|options = \" $options\"|" \
-e "s|^[:space:]*make_options =.*|make_options = \" $make_options\"|" \
< $CONFFILE > $CONFFILE.tmp
mv -f $CONFFILE.tmp $CONFFILE
fi
|