summarylogtreecommitdiffstats
path: root/lze-web.install
blob: bceddbaaa5ea61b23949261204e5417817fdecb4 (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
post_install() {
  if [ -n "$SUDO_USER" ]; then
    cu_user="$SUDO_USER"
else
    cu_user=$(whoami)
fi

  mkdir -p /$cu_user
  mkdir -p /$cu_user/Documents/upload
  mkdir -p /$cu_user/Pictures
  mkdir -p /$cu_user/Note
  mkdir -p /$cu_user/Bookmark
  mkdir -p /$cu_user/Monitor
  chmod 777  -R /$cu_user
  chmod 777  -R /opt/lze-web
  chmod 755 -R /etc/lze-web
  chmod 766 -R /etc/lze-web/*
  ln -sf /$cu_user /opt/lze-web/file
  mv /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.back
  mv /etc/httpd/conf/httpd.conf.lze /etc/httpd/conf/httpd.conf
  sed -i "202i User $cu_user" /etc/httpd/conf/httpd.conf
  sed -i "203i Group $cu_user" /etc/httpd/conf/httpd.conf
  touch /etc/sudoers.d/brightness
 echo "$cu_user ALL = (root) NOPASSWD: /usr/bin/brightnessctl" > /etc/sudoers.d/brightness
  mv /etc/php/php.ini /etc/php/php.ini.bck
  mv /etc/php/php.ini.lze /etc/php/php.ini
  systemctl enable httpd.service
  systemctl restart httpd.service
}
post_upgrade() {
  post_remove
	post_install
}

pre_remove() {
	#

	action="$1"
	if [ "$2" = "in-favour" ]; then
	  # Treat conflict remove as an upgrade.
	  action="upgrade"
	fi

}

post_remove() {
rm -rf /opt/lze-web
rm /usr/bin/lze-web
rm /usr/bin/lze-notify
rm -rf /etc/lze-web
mv /etc/httpd/conf/httpd.conf.bck  /etc/httpd/conf/httpd.conf 
mv /etc/php/php.ini.bck  /etc/php/php.ini
}