File: mk-symlinks

package info (click to toggle)
diff 2.7-21
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,288 kB
  • ctags: 981
  • sloc: ansic: 11,048; makefile: 203; sh: 202
file content (26 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
package=$1
debiandir=debian/tmp/DEBIAN
if [ "$2" != "" ]; then
  debiandir=debian/$2/DEBIAN
fi
if [ ! -f $debiandir/postinst ]; then
  echo "#!/bin/sh" > $debiandir/postinst
  chmod 755 $debiandir/postinst
fi
if [ ! -f $debiandir/prerm ]; then
  echo "#!/bin/sh" > $debiandir/prerm
  chmod 755 $debiandir/prerm
fi
cat << EOF >> $debiandir/postinst
if [ "\$1" = "configure" ]; then
  if [ -d /usr/doc -a ! -e /usr/doc/$package -a -d /usr/share/doc/$package ]; then
    ln -sf ../share/doc/$package /usr/doc/$package
  fi
fi
EOF
cat << EOF >> $debiandir/prerm
if [ \( "\$1" = "upgrade" -o "\$1" = "remove" \) -a -L /usr/doc/$package ]; then
  rm -f /usr/doc/$package
fi
EOF