[rstudio] 03/07: Found postinit and postrm scripts in upstream source which were on one hand totally wrong but leave some helpful hints which are kept here.

Andreas Tille tille at debian.org
Thu Apr 28 12:06:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository rstudio.

commit 17f177d6097d8c22df5fd33c81cd712a508937e5
Author: Andreas Tille <tille at debian.org>
Date:   Thu Apr 28 13:02:47 2016 +0200

    Found postinit and postrm scripts in upstream source which were on one hand totally wrong but leave some helpful hints which are kept here.
---
 debian/postinst | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/postrm   | 22 +++++++++++++++
 2 files changed, 109 insertions(+)

diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000..631694d
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,87 @@
+#!/bin/sh -e
+
+case "$1" in
+  configure)
+    # add rserver user account
+    useradd -r rstudio-server
+    groupadd -r rstudio-server
+    
+    # create softlink to admin script in /usr/sbin
+    ## remaining from broken postinst delivered by upstream gives a hint where to put rstudio-server
+    ## ln -f -s ${CMAKE_INSTALL_PREFIX}/bin/rstudio-server /usr/sbin/rstudio-server
+    
+    # create config directory and default config files
+    ## That's totally broken config file handling
+    ## TODO: make sure the package contains proper config files
+    # mkdir -p /etc/rstudio
+    #if ! test -f /etc/rstudio/rserver.conf
+    #then
+    #  sh -c "printf '# Server Configuration File\n\n' > /etc/rstudio/rserver.conf"
+    #fi
+    #if ! test -f /etc/rstudio/rsession.conf
+    #then
+    #  sh -c "echo '# R Session Configuration File\n\n' > /etc/rstudio/rsession.conf"
+    #fi
+    
+    # create var directories
+    mkdir -p /var/run/rstudio-server
+    mkdir -p /var/lock/rstudio-server
+    mkdir -p /var/log/rstudio-server
+    mkdir -p /var/lib/rstudio-server
+    mkdir -p /var/lib/rstudio-server/conf
+    mkdir -p /var/lib/rstudio-server/body
+    mkdir -p /var/lib/rstudio-server/proxy
+    
+    # suspend all sessions
+    rstudio-server force-suspend-all
+    
+    # check lsb release and init system
+    LSB_RELEASE=`lsb_release --id --short`
+    INIT_SYSTEM=`cat /proc/1/comm 2>/dev/null`
+    
+    # add apparmor profile (but don't for systemd as this borks up process management)
+    if test $LSB_RELEASE = "Ubuntu" && test -d /etc/apparmor.d/ && ! test $INIT_SYSTEM = "systemd"
+    then
+       # TODO: Probably it makes sense to copy apparmor files - if apparmor is used
+       #       by the system than we assume that its usable
+       # cp ${CMAKE_INSTALL_PREFIX}/extras/apparmor/rstudio-server /etc/apparmor.d/
+       apparmor_parser -r /etc/apparmor.d/rstudio-server 2>/dev/null
+    elif test -e /etc/apparmor.d/rstudio-server
+    then
+       rm -f /etc/apparmor.d/rstudio-server
+       invoke-rc.d apparmor reload 2>/dev/null
+    fi
+
+    # add systemd, upstart, or init.d script and start the server
+    if test "$INIT_SYSTEM" = "systemd"
+    then
+       # systemctl stop rstudio-server.service 2>/dev/null
+       # systemctl disable rstudio-server.service 2>/dev/null
+       # TODO: Proper init script!!
+       # cp ${CMAKE_INSTALL_PREFIX}/extras/systemd/rstudio-server.service /etc/systemd/system/rstudio-server.service
+       # systemctl daemon-reload
+       # systemctl enable rstudio-server.service
+       # systemctl start rstudio-server.service
+       sleep 1
+       systemctl --no-pager status rstudio-server.service
+    else
+       # TODO: Proper init script!!
+       # cp ${CMAKE_INSTALL_PREFIX}/extras/init.d/debian/rstudio-server /etc/init.d/
+       # sudo chmod +x /etc/init.d/rstudio-server
+       #sudo update-rc.d rstudio-server defaults
+       #sudo /etc/init.d/rstudio-server stop  2>/dev/null
+       #sudo /etc/init.d/rstudio-server start
+    fi
+  ;;
+  abort-upgrade|abort-remove|abort-deconfigure)
+    echo "$1"
+  ;;
+  *)
+    echo "postinst called with unknown argument \`\$1'" >&2
+    exit 0
+  ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100755
index 0000000..5dc471b
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+case "$1" in
+  remove)
+    echo $1
+  ;;
+  purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    # remove temporary streams
+    rm -rf /tmp/rstudio-rsession
+    rm -rf /tmp/rstudio-rserver
+    
+    rm -rf /etc/systemd/system/rstudio-server.service
+  ;;
+  *)
+    echo "postrm called with unknown argument \`\$1'" >&2
+    exit 0
+  ;;
+esac
+
+#DEBHELPER#
+
+exit 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/rstudio.git



More information about the debian-science-commits mailing list