mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-12-26 00:52:46 +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
|
[[ $downloaded == false ]] && ERROR=1
|
||||||
done
|
done
|
||||||
|
|
||||||
mv ${pkgidx_tmp_dir}/* ${pkgidx_dir}
|
dir-not-empty ${pkgidx_tmp_dir} && mv ${pkgidx_tmp_dir}/* ${pkgidx_dir}
|
||||||
mv ${comp_tmp_dir}/* ${comp_dir}
|
dir-not-empty ${dist_tmp_dir} && mv ${dist_tmp_dir}/* ${dist_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}
|
rmdir ${pkgidx_tmp_dir} ${dist_tmp_dir} ${comp_tmp_dir}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,15 @@ function check-and-download() {
|
||||||
return
|
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"
|
LOADED_HELPERS="yes"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue