Skip to content

Commit f9d72b7

Browse files
author
Marian Marinov
committed
builds/hawk-centos7.spec: Fixes for the install and upgrade processes
During upgrade of hawk, we are deleting the hawk user, which deletes the sqlite file, that was initially created during installation. It also leaves the hawk group, which results in issues during upgrade and install. In addition we were missing the creation of the cache dir, when we were upgrading, because %postun was called without check if it was un upgrade or uninstall. The fixes here try to solve the above provlems.
1 parent acd5889 commit f9d72b7

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

builds/hawk-centos7.spec

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ fi
8686

8787
# Initialize the Hawk SQLite DB
8888
if [ ! -f /var/cache/hawk/hawk.sqlite ]; then
89+
if [ ! -d /var/cache/hawk ]; then
90+
mkdir -p /var/cache/hawk
91+
fi
8992
sqlite3 /var/cache/hawk/hawk.sqlite < /usr/share/hawk/hawk_db.sqlite
90-
chown hawk: /usr/share/hawk/hawk_db.sqlite
93+
chown hawk: /var/cache/hawk/hawk.sqlite
9194
fi
9295

9396
%preun
@@ -98,8 +101,11 @@ fi
98101
%postun
99102
%systemd_postun_with_restart hawk.service
100103

101-
if getent passwd hawk > /dev/null; then
102-
userdel -r hawk
104+
if [ "$1" == "0" ]; then
105+
if getent passwd hawk > /dev/null; then
106+
userdel -r hawk
107+
groupdel hawk
108+
fi
103109
fi
104110

105111
%posttrans

0 commit comments

Comments
 (0)