From f2176428bc2d262fae385630d58564b56f610c9b Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 7 Dec 2019 16:29:41 +0100 Subject: [PATCH] Use find in clean-all instead of ls --- build/clean-all.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/clean-all.sh b/build/clean-all.sh index 242888a..3980029 100755 --- a/build/clean-all.sh +++ b/build/clean-all.sh @@ -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