:: [DNG] [Ruby on rails - RVM] Patch f…
Forside
Slet denne besked
Besvar denne besked
Skribent: aleskandro
Dato:  
Til: dng
Emne: [DNG] [Ruby on rails - RVM] Patch for RVM and Devuan
Hi all, I have to develop a simple app in ruby on rails for an exam in my
university. To deploy it I chose Devuan so that I can start to try it and not
use systemd.
Installing rvm I see that it detect the distro 'automagically' to install
needed dependencies: Devuan have not /etc/debian_version (but
/etc/devuan_version) and the script doesn't recognize our distro.

Well I created a simple patch to solve this issue, I upload it here.

I opened an issue with this patch into github project of rvm (I don't know if
it is the better way to sent a patch):
https://github.com/rvm/rvm/issues/3482[1]

A very small contribution to an important project

--
Happy hacking
Aleskandro

--------
[1] https://github.com/rvm/rvm/issues/3482
diff -u --recursive --new-file rvm.old/scripts/functions/detect_system rvm/scripts/functions/detect_system
--- scripts/functions/detect_system    2015-08-05 15:29:50.124352334 +0200
+++ scripts/functions/detect_system    2015-08-05 15:39:00.640372870 +0200
@@ -58,6 +58,12 @@
         _system_version="$(\command \cat /etc/debian_version | \command \awk -F. '{print $1}' | head -n 1)"
         _system_arch="$( dpkg --print-architecture )"
       elif
+     [[ -f /etc/devuan_version ]]
+      then
+        _system_name="Devuan"
+        _system_version="$(\command \cat /etc/devuan_version | \command \awk -F. '{print $1}' | head -n 1)"
+        _system_arch="$( dpkg --print-architecture )"
+      elif
         [[ -f /etc/os-release ]] &&
         GREP_OPTIONS="" \command \grep "ID=debian" /etc/os-release >/dev/null
       then
diff -u --recursive --new-file rvm.old/scripts/functions/requirements/devuan rvm/scripts/functions/requirements/devuan
--- scripts/functions/requirements/devuan    1970-01-01 01:00:00.000000000 +0100
+++ scripts/functions/requirements/devuan    2015-08-05 15:39:00.636372869 +0200
@@ -0,0 +1,141 @@
+#!/usr/bin/env bash
+
+# AMD64, i386, ARM.
+requirements_devuan_arch()
+{
+  __architecture="$(dpkg --print-architecture)"
+}
+
+# Queries the dpkg system for packages that are installed only asking about
+# the package name and it's arch.  This package will fall back to :all for
+# cases where we cannot get an arch specific package (such is the case
+# for a few packages.)
+
+requirements_devuan_lib_installed()
+{
+  dpkg-query -s "${1}:${__architecture}" >/dev/null 2>&1 ||
+  dpkg-query -s "${1}:all"               >/dev/null 2>&1 ||
+  dpkg-query -s "$1" 2>/dev/null | __rvm_grep "Architecture: ${__architecture}" >/dev/null ||
+  dpkg-query -s "$1" 2>/dev/null | __rvm_grep "Architecture: all"               >/dev/null ||
+  return $?
+}
+
+# Informs us if a package is even available on the distro we are working
+# with, this is more of a transitional method kind of like Ubuntu
+# has a transitional git-core package right now.  This will allow us
+# to continue to support older versions of Ubuntu while enforcing newer
+# packages on newer Ubuntu.
+
+requirements_devuan_lib_available()
+{
+  apt-cache show "$1" >/dev/null 2>&1 || return $?
+}
+
+requirements_devuan_libs_install()
+{
+  __rvm_try_sudo apt-get --no-install-recommends --yes install "$@" || return $?
+}
+
+requirements_devuan_update_system()
+{
+  __rvm_try_sudo apt-get --quiet --yes update ||
+  {
+    \typeset __ret=$?
+    case ${__ret} in
+      (100)
+        rvm_error "There has been error while updating 'apt-get', please give it some time and try again later.
+404 errors should be fixed for rvm to proceed. Check your sources configured in:
+    /etc/apt/sources.list
+    /etc/apt/sources.list.d/*.list
+"
+        ;;
+    esac
+    return ${__ret}
+  }
+}
+
+requirements_devuan_define_java()
+{
+  update-alternatives --list ${1:-java} >/dev/null 2>&1 ||
+    requirements_check_fallback \
+      openjdk-7-jre-headless openjdk-7-jdk oracle-j2sdk1.7 \
+      openjdk-6-jre-headless opendjk-6-jdk oracle-j2sdk1.6
+}
+
+requirements_devuan_define()
+{
+  \typeset __architecture
+  requirements_devuan_arch
+
+  case "$1" in
+    (rvm)
+      requirements_check bash curl patch bzip2 ca-certificates gawk
+      ;;
+
+    (jruby*)
+      requirements_check g++
+      if
+        is_head_or_disable_binary "$1"
+      then
+        requirements_devuan_define_java javac
+        requirements_check_fallback git git-core
+        if is_jruby_post17 "$1"
+        then __rvm_which mvn >/dev/null || requirements_check_fallback maven maven2
+        else __rvm_which ant >/dev/null || requirements_check ant
+        fi
+      else
+        requirements_devuan_define_java java
+      fi
+      ;;
+
+    (ir*)
+      requirements_check curl mono-2.0-devel
+      ;;
+
+    (opal)
+      requirements_check nodejs npm
+      ;;
+
+    (rbx*head|rubinius*head)
+      requirements_check_fallback git git-core
+      requirements_ubuntu_libs_default clang llvm
+      rvm_configure_flags+=( --cc=clang --cxx=clang++ )
+      ;;
+
+    (rbx*|rubinius*)
+      requirements_ubuntu_libs_default clang llvm llvm-dev libedit-dev
+      rvm_configure_flags+=( --cc=clang --cxx=clang++ )
+      ;;
+
+    (*-head)
+      requirements_check_fallback git git-core
+      requirements_ubuntu_libs_default g++ gcc
+      ;;
+
+    (*)
+      # Also ran by *-head.
+      requirements_ubuntu_libs_default g++ gcc
+      ;;
+  esac
+}
+
+requirements_ubuntu_libs_default()
+{
+  requirements_check "$@" \
+    make libc6-dev patch openssl ca-certificates libreadline6 \
+    libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev \
+    libsqlite3-dev sqlite3 autoconf \
+    libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev
+}
+
+requirements_ubuntu_define()
+{
+  __lib_type=devuan
+  requirements_devuan_define "$@"
+}
+
+requirements_mint_define()
+{
+  __lib_type=devuan
+  requirements_devuan_define "$@"
+}