Newer
Older
Digital_Repository / OARiNZ / DIY / webmin-oarinz / webmin-oarinz-1.340 / debian / postinst
nstanger on 20 Jun 2007 2 KB - First working version.
  1. #!/bin/sh
  2. # postinst script for webmin-oarinz
  3.  
  4. inetd=`grep "^inetd=" /etc/webmin/miniserv.conf 2>/dev/null | sed -e 's/inetd=//g'`
  5. if [ "$1" = "upgrade" ]; then
  6. # Upgrading the package, so stop the old webmin properly
  7. if [ "$inetd" != "1" ]; then
  8. invoke-rc.d webmin stop >/dev/null 2>&1 </dev/null
  9. fi
  10. fi
  11. cd /usr/share/webmin
  12. config_dir=/etc/webmin
  13. var_dir=/var/webmin
  14. perl=/usr/bin/perl
  15. autoos=3
  16. if [ "$WEBMIN_PORT" != "" ]; then
  17. port=$WEBMIN_PORT
  18. else
  19. port=10000
  20. fi
  21. login=admin
  22. password=admin
  23. host=`hostname`
  24. ssl=1
  25. atboot=1
  26. nochown=1
  27. autothird=1
  28. nouninstall=1
  29. nostart=1
  30. export config_dir var_dir perl autoos port login password host ssl nochown autothird nouninstall nostart allow atboot
  31. ./setup.sh >/tmp/.webmin/webmin-setup.out 2>&1
  32. if [ "webmin" = "webmin" ]; then
  33. grep sudo= /etc/webmin/miniserv.conf >/dev/null 2>&1
  34. if [ "$?" = 1 ]; then
  35. # Allow sudo-based logins for Ubuntu
  36. echo sudo=1 >>/etc/webmin/miniserv.conf
  37. fi
  38. fi
  39. rm -f /var/lock/subsys/webmin
  40. if [ "" != "1" ]; then
  41. invoke-rc.d webmin start >/dev/null 2>&1 </dev/null
  42. fi
  43. cat >/etc/webmin/uninstall.sh <<EOFF
  44. #!/bin/sh
  45. printf "Are you sure you want to uninstall Webmin? (y/n) : "
  46. read answer
  47. printf "\n"
  48. if [ "\$answer" = "y" ]; then
  49. echo "Removing Webmin package .."
  50. dpkg --remove webmin
  51. echo "Done!"
  52. fi
  53. EOFF
  54. chmod +x /etc/webmin/uninstall.sh
  55. port=`grep "^port=" /etc/webmin/miniserv.conf | sed -e 's/port=//g'`
  56. perl -e 'use Net::SSLeay' >/dev/null 2>/dev/null
  57. sslmode=0
  58. if [ "$?" = "0" ]; then
  59. grep ssl=1 /etc/webmin/miniserv.conf >/dev/null 2>/dev/null
  60. if [ "$?" = "0" ]; then
  61. sslmode=1
  62. fi
  63. fi
  64. if [ "$sslmode" = "1" ]; then
  65. echo "Webmin install complete. You can now login to https://$host:$port/"
  66. else
  67. echo "Webmin install complete. You can now login to http://$host:$port/"
  68. fi
  69. if [ "webmin" = "webmin" ]; then
  70. echo "as root with your root password, or as any user who can use sudo"
  71. echo "to run commands as root."
  72. else
  73. echo "as any user on the system."
  74. fi
  75.  
  76. # dh_installdeb will replace this with shell code automatically
  77. # generated by other debhelper scripts.
  78.  
  79. #DEBHELPER#
  80.  
  81. exit 0