File: ruby-standalone.in

package info (click to toggle)
ruby-standalone 3.0~2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92 kB
  • sloc: sh: 98; makefile: 68; ansic: 25; ruby: 6
file content (25 lines) | stat: -rw-r--r-- 583 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -eu

ruby_standalone_dir=@@prefix@@/lib/ruby-standalone
user=$(id -un)
shell=$(getent passwd "${user}" | cut -d : -f 7)

export RUBY_STANDALONE='@@prefix@@/lib/ruby-standalone'
export RUBY="${ruby_standalone_dir}/bin/ruby"
bindir="$($RUBY -e 'puts Gem.user_dir')/bin"
export PATH="$bindir:${ruby_standalone_dir}/bin:${PATH}"

# symlink rubyX.Y to ruby
vruby=$($RUBY -e 'puts RbConfig::CONFIG["ruby_install_name"]')
if [ ! -e "$bindir/$vruby" ]; then
  mkdir -p "$bindir"
  ln -sfT "$RUBY" "$bindir/$vruby"
fi

if [ $# -eq 0 ]; then
  exec "$shell"
else
  exec "$@"
fi