grafana-alloy: don't build the frontend twice
[NixPkgs.git] / nixos / modules / services / web-servers / jboss / builder.sh
blob8c49b87db0604d6601524b3d39889dfe135ac9f9
1 set -e
3 if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
4 source $stdenv/setup
6 mkdir -p $out/bin
8 cat > $out/bin/control <<EOF
9 mkdir -p $logDir
10 chown -R $user $logDir
11 export PATH=$PATH:$su/bin
13 start()
15 su $user -s /bin/sh -c "$jboss/bin/run.sh \
16 -Djboss.server.base.dir=$serverDir \
17 -Djboss.server.base.url=file://$serverDir \
18 -Djboss.server.temp.dir=$tempDir \
19 -Djboss.server.log.dir=$logDir \
20 -Djboss.server.lib.url=$libUrl \
21 -c default"
24 stop()
26 su $user -s /bin/sh -c "$jboss/bin/shutdown.sh -S"
29 if test "\$1" = start
30 then
31 trap stop 15
33 start
34 elif test "\$1" = stop
35 then
36 stop
37 elif test "\$1" = init
38 then
39 echo "Are you sure you want to create a new server instance (old server instance will be lost!)?"
40 read answer
42 if ! test \$answer = "yes"
43 then
44 exit 1
47 rm -rf $serverDir
48 mkdir -p $serverDir
49 cd $serverDir
50 cp -av $jboss/server/default .
51 sed -i -e "s|deploy/|$deployDir|" default/conf/jboss-service.xml
53 if ! test "$useJK" = ""
54 then
55 sed -i -e 's|<attribute name="UseJK">false</attribute>|<attribute name="UseJK">true</attribute>|' default/deploy/jboss-web.deployer/META-INF/jboss-service.xml
56 sed -i -e 's|<Engine name="jboss.web" defaultHost="localhost">|<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">|' default/deploy/jboss-web.deployer/server.xml
59 # Make files accessible for the server user
61 chown -R $user $serverDir
62 for i in \`find $serverDir -type d\`
64 chmod 755 \$i
65 done
66 for i in \`find $serverDir -type f\`
68 chmod 644 \$i
69 done
71 EOF
73 chmod +x $out/bin/*