Use find in clean-all instead of ls

This commit is contained in:
Disassembler 2019-12-07 16:29:41 +01:00
parent 91a5a24b1b
commit f2176428bc
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -17,8 +17,8 @@ rm -f /srv/build/lxc/packages.sig
echo '{"apps":{},"images":{}}' >/srv/build/lxc/packages
# Stop running containers
for SERVICE in $(ls -1 /run/openrc/started/lxc-*); do
service ${SERVICE} stop
for SERVICE in $(find /run/openrc/started -name 'lxc-*'); do
service $(basename ${SERVICE}) stop
done
# Remove services
@ -29,13 +29,13 @@ rc-update -u
rm -rf /var/lib/lxc/*
# Remove application data
for DIR in $(ls -1 /srv | grep -v ^build$); do
rm -rf /srv/${DIR}
for DIR in $(find /srv ! -path /srv/build -maxdepth 1 -mindepth 1); do
rm -rf ${DIR}
done
# Remove nginx configs
for FILE in $(ls -1 /etc/nginx/conf.d | grep -Ev ^(apkrepo|default).conf$); do
rm -f /etc/nginx/conf.d/${FILE}
for CONF in $(find /etc/nginx/conf.d -name '*.conf' -a ! -name apkrepo.conf -a ! -name default.conf); do
rm -f ${CONF}
done
service nginx reload