+ print(line, file=f)
+ # maintainer scripts for alternatives
+ if 'alternatives' in config:
+ with open('debian/'+binaryName+'.postinst', 'w') as f:
+ print("#!/bin/sh", file=f)
+ print("set -e", file=f)
+ print('if [ "$1" = "configure" ]; then', file=f)
+ for alternative in config.get('alternatives'):
+ alternative = shlex.split(alternative)
+ print(safeCall('update-alternatives', '--install', alternative[0], alternative[1], alternative[2], alternative[3]), file=f)
+ print('fi', file=f)
+ print(file=f)
+ print('#DEBHELPER#', file=f)
+ print(file=f)
+ print('exit 0', file=f)
+ with open('debian/'+binaryName+'.prerm', 'w') as f:
+ print("#!/bin/sh", file=f)
+ print("set -e", file=f)
+ print('if [ "$1" = "remove" ]; then', file=f)
+ for alternative in config.get('alternatives'):
+ alternative = shlex.split(alternative)
+ print(safeCall('update-alternatives', '--remove', alternative[1], alternative[2]), file=f)
+ print('fi', file=f)
+ print(file=f)
+ print('#DEBHELPER#', file=f)
+ print(file=f)
+ print('exit 0', file=f)