mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-06-30 23:12:45 +00:00
dir-not-empty function
This commit is contained in:
parent
f146cf65a2
commit
7fca77ec9f
@ -161,9 +161,9 @@ function apt-download-binary() {
|
||||
[[ $downloaded == false ]] && ERROR=1
|
||||
done
|
||||
|
||||
mv ${pkgidx_tmp_dir}/* ${pkgidx_dir}
|
||||
mv ${comp_tmp_dir}/* ${comp_dir}
|
||||
mv ${dist_tmp_dir}/* ${dist_dir}
|
||||
dir-not-empty ${pkgidx_tmp_dir} && mv ${pkgidx_tmp_dir}/* ${pkgidx_dir}
|
||||
dir-not-empty ${dist_tmp_dir} && mv ${dist_tmp_dir}/* ${dist_dir}
|
||||
dir-not-empty ${comp_tmp_dir} && mv ${comp_tmp_dir}/* ${comp_dir}
|
||||
|
||||
rmdir ${pkgidx_tmp_dir} ${dist_tmp_dir} ${comp_tmp_dir}
|
||||
|
||||
|
@ -13,5 +13,15 @@ function check-and-download() {
|
||||
return
|
||||
}
|
||||
|
||||
function dir-not-empty() {
|
||||
local dir=$1
|
||||
[[ ! -d "$dir" ]] && return 1
|
||||
nfiles=$(ls -a "$dir" | wc -l)
|
||||
if (( ${nfiles} > 2 )); then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
LOADED_HELPERS="yes"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user