Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3048ea2716 | |||
| d04bdce2f7 |
@@ -58,6 +58,8 @@ rm --recursive %{_tmppath}/gitea_images
|
|||||||
# Create postgres user and db
|
# Create postgres user and db
|
||||||
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
|
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
|
||||||
runuser --user=postgres -- createuser gitea
|
runuser --user=postgres -- createuser gitea
|
||||||
|
fi
|
||||||
|
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\l' | grep --quiet gitea; then
|
||||||
runuser --user=postgres -- createdb --owner=gitea gitea
|
runuser --user=postgres -- createdb --owner=gitea gitea
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -95,12 +97,26 @@ systemctl reenable gitea.service
|
|||||||
systemctl restart gitea.service nginx.service
|
systemctl restart gitea.service nginx.service
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
# If removing, delete users and db
|
# If uninstalling, then delete users and db
|
||||||
if [ $1 == 0 ]; then
|
if [ $1 == 0 ]; then
|
||||||
userdel --force --remove gitea
|
# Remove gitea user if existing
|
||||||
runuser --user=postgres -- psql --command='DROP DATABASE gitea; DROP USER gitea;'
|
if id gitea >/dev/null 2>&1; then
|
||||||
|
userdel --force --remove gitea
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove gitea database if existing
|
||||||
|
if runuser --user=postgres -- psql --quiet --tuples-only --command='\l' | grep --quiet gitea; then
|
||||||
|
runuser --user=postgres -- dropdb gitea
|
||||||
|
fi
|
||||||
|
if runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
|
||||||
|
runuser --user=postgres -- dropuser gitea
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove actrunner users if existing
|
||||||
for i in $(seq 1 4); do
|
for i in $(seq 1 4); do
|
||||||
userdel --force --remove actrunner$i
|
if id actrunner$i >/dev/null 2>&1; then
|
||||||
|
userdel --force --remove actrunner$i
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user