cleanfs: Clean /home/nobody/ as well

Message ID 6c55f0b1-e991-41a4-a98b-ca387bb37f6c@ipfire.org
State New
Headers
Series cleanfs: Clean /home/nobody/ as well |

Commit Message

Peter Müller June 16, 2024, 2:37 p.m. UTC
  Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 src/initscripts/system/cleanfs | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Nick Howitt June 16, 2024, 2:54 p.m. UTC | #1
Can I ask why a cd is done in each command? It should not fail but risks 
it and it is unnecessary

    find /home/nobody/ -mindepth 1 -delete || failed=1

is the same as:

    cd /home/nobody/ && find -mindepth 1 -delete || failed=1


The same can be for clearing /tmp which appears to follow.

Nick

On 16/06/2024 15:37, Peter Müller wrote:
> Signed-off-by: Peter Müller<peter.mueller@ipfire.org>
> ---
>   src/initscripts/system/cleanfs | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/src/initscripts/system/cleanfs b/src/initscripts/system/cleanfs
> index d1cbb2547..c78703070 100644
> --- a/src/initscripts/system/cleanfs
> +++ b/src/initscripts/system/cleanfs
> @@ -112,6 +112,9 @@ case "${1}" in
>   		fi
>   		boot_mesg -n "Cleaning file systems:" ${INFO}
>   
> +		boot_mesg -n " /home/nobody" ${NORMAL}
> +		cd /home/nobody/ && find . -mindepth 1 -delete || failed=1
> +
>   		boot_mesg -n " /tmp" ${NORMAL}
>   		cd /tmp &&
>   		find . -xdev -mindepth 1 ! -name lost+found \
  
Nick Howitt June 16, 2024, 5:39 p.m. UTC | #2
I don't know what happened to the "." in the second command. The message 
should read:

    find /home/nobody/ -mindepth 1 -delete || failed=1

is the same as:

    cd /home/nobody/ && find . -mindepth 1 -delete || failed=1

It would save the cd and the &&.

On 16/06/2024 15:54, Nick Howitt wrote:
> Can I ask why a cd is done in each command? It should not fail but 
> risks it and it is unnecessary
>
>     find /home/nobody/ -mindepth 1 -delete || failed=1
>
> is the same as:
>
>     cd /home/nobody/ && find  -mindepth 1 -delete || failed=1
>
>
> The same can be for clearing /tmp which appears to follow.
>
> Nick
>
> On 16/06/2024 15:37, Peter Müller wrote:
>> Signed-off-by: Peter Müller<peter.mueller@ipfire.org>
>> ---
>>   src/initscripts/system/cleanfs | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/src/initscripts/system/cleanfs b/src/initscripts/system/cleanfs
>> index d1cbb2547..c78703070 100644
>> --- a/src/initscripts/system/cleanfs
>> +++ b/src/initscripts/system/cleanfs
>> @@ -112,6 +112,9 @@ case "${1}" in
>>   		fi
>>   		boot_mesg -n "Cleaning file systems:" ${INFO}
>>   
>> +		boot_mesg -n " /home/nobody" ${NORMAL}
>> +		cd /home/nobody/ && find . -mindepth 1 -delete || failed=1
>> +
>>   		boot_mesg -n " /tmp" ${NORMAL}
>>   		cd /tmp &&
>>   		find . -xdev -mindepth 1 ! -name lost+found \
>
  

Patch

diff --git a/src/initscripts/system/cleanfs b/src/initscripts/system/cleanfs
index d1cbb2547..c78703070 100644
--- a/src/initscripts/system/cleanfs
+++ b/src/initscripts/system/cleanfs
@@ -112,6 +112,9 @@  case "${1}" in
 		fi
 		boot_mesg -n "Cleaning file systems:" ${INFO}
 
+		boot_mesg -n " /home/nobody" ${NORMAL}
+		cd /home/nobody/ && find . -mindepth 1 -delete || failed=1
+
 		boot_mesg -n " /tmp" ${NORMAL}
 		cd /tmp &&
 		find . -xdev -mindepth 1 ! -name lost+found \