summarylogtreecommitdiffstats
path: root/cloud9.install
blob: 04776bdbe944b6d76bed18c0ec11944605478274 (plain)
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
32
33
34
35
36
37
post_install() {
  getent group cloud9 > /dev/null || groupadd -g 419 cloud9
  if ! getent passwd cloud9 > /dev/null; then
	  useradd -c 'Cloud9 user' -u 419 -g cloud9 -G audio,video,network,optical -d /opt/cloud9 -s /usr/bin/bash cloud9
	  passwd -l cloud9 > /dev/null
  fi
  
  echo "Notes:"
  echo "------"
  echo "* The default workspace is the working directory."
  echo "* Call 'cloud9 -w <workspace>' to switch to a different workspace."
  echo "* To listen on a different port you can use the '-p' switch." 
  echo "* See 'cloud9 --help' for more information."
}

post_upgrade() {
  post_install $1
  if ! getent group cloud9 | cut -d: -f3 | grep 419 > /dev/null 2>&1; then
	  groupmod -g 419 cloud9 > /dev/null 2>&1
  fi
  if ! id -u cloud9 | grep 419 > /dev/null 2>&1; then
	  usermod -u 419 cloud9 > /dev/null 2>&1
	  if [[ $? -ne 0 ]]; then
		  echo "Changing uid of user cloud9 failed"
		  echo "It is recommended that the uid is changed."
		  echo "Stop all processes running under the cloud9 user and reinstall cloud9"
		  echo "or change the uid manually. (usermod -u 419 cloud9)"
	  fi
	  chown -R 419:419 /opt/cloud9
  fi
}

post_remove() {
  getent passwd cloud9 > /dev/null 2>&1 && userdel cloud9
  getent group cloud9 > /dev/null 2>&1 && groupdel cloud9
}