File: ruby.postinst

package info (click to toggle)
ruby-defaults 1:2.3.3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 128 kB
  • ctags: 6
  • sloc: sh: 70; ruby: 55; makefile: 20
file content (31 lines) | stat: -rw-r--r-- 876 bytes parent folder | download
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
#!/bin/sh

set -e

update-alternatives --remove-all ruby 2>/dev/null || true
update-alternatives --remove-all gem 2>/dev/null || true

version=2.3

# restore the default version overwriting any change made by
# update-alternatives
for program in erb gem irb rdoc ri ruby; do
  target=$(readlink -f /usr/bin/$program)
  if [ ! -e /usr/bin/$program -o "$target" = /usr/bin/${program}1.8 -o "$target" = /usr/bin/${program}1.9.1 ]
  then
    echo "Fixing symlink /usr/bin/$program -> $program$version"
    ln -sf $program$version /usr/bin/$program
  fi
done

# this is a horrible hack, but will prevent reconfiguration of ruby1.8 or
# ruby1.9.1 from re-adding the alternatives entries.
for package in ruby1.8 ruby1.9.1; do
  postinst=/var/lib/dpkg/info/$package.postinst
  if [ -e $postinst ]
  then
    sed -i -e 's/^\s*update-alternatives/: &/' $postinst
  fi
done

#DEBHELPER#