summarylogtreecommitdiffstats
path: root/neo4j.install
blob: 46a23f6825914bee21a43c47c83d2c6d734dc11a (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
post_install() {
  assert_user_and_group_exist

  chown -R neo4j.neo4j /var/lib/neo4j
  chown -R neo4j.neo4j /var/log/neo4j
  chown -R neo4j.neo4j /etc/neo4j

  /usr/bin/systemd-tmpfiles --create neo4j.conf

  warn_about_java_home
}

post_upgrade() {
  assert_user_and_group_exist
  warn_about_java_home
}

post_remove() {
  if getent passwd neo4j >/dev/null; then
    userdel neo4j
  fi
  if getent group neo4j >/dev/null; then
    groupdel neo4j
  fi
}

assert_user_and_group_exist() {
  if ! getent group neo4j >/dev/null; then
    groupadd --system neo4j
  fi
  if ! getent passwd neo4j >/dev/null; then
    useradd --system -g neo4j -d /var/lib/neo4j -s /bin/false neo4j
  fi
}

warn_about_java_home() {
  echo "---------------"
  echo "--- HOORAY!! --"
  echo "---------------"
  echo "If it is the first time you install Neo4j in your"
  echo "Arch box, that's it, you are done. Enjoy your graphs"
  echo "and please disregard all that is said from now on..."
  echo ""
  echo "If you are upgrading Neo4j from a previous version and"
  echo "were given the following advice:"
  echo ""
  echo "  >> ------------------------------"
  echo "  >> --- ACHTUNG ACHTUNG ALARM! ---"
  echo "  >> ------------------------------"
  echo "  >> Before starting the Neo4j service, create this file"
  echo "  >> "
  echo "  >> /etc/systemd/system/neo4j.service.d/java_home.conf"
  echo "  >> "
  echo "  >> with the following content:"
  echo "  >> "
  echo "  >> [Service]"
  echo "  >> Environment=JAVA_HOME=/your/java/home/path"
  echo "  >> "
  echo "  >> changing '/your/java/home/path' to your actual JAVA_HOME path."
  echo ""
  echo "then now you are free to delete that file. Actually,"
  echo "pursuant to the new Arch's Java Way of Life"
  echo "(https://wiki.archlinux.org/index.php/Java#Former_.22One_time_setup.22_trick)"
  echo "you shall delete it. Thereupon, enjoy your graphs."
  echo ""
  echo "This message will self-destruct in 2 s̶e̶c̶o̶n̶d̶s̶ releases..."
}