fix cp issue

This commit is contained in:
CanbiZ 2025-07-28 12:58:24 +02:00
parent d28237502d
commit e8764ef60d
2 changed files with 27 additions and 9 deletions

View File

@ -1212,7 +1212,7 @@ EOF
seen_devices["$dev_target"]=1 seen_devices["$dev_target"]=1
pci_addr=$(basename "$bypath" | cut -d- -f1 --complement | sed 's/-render//' || true) pci_addr=$(basename "$bypath" | cut -d- -f1 --complement | sed 's/-render//' || true)
pci_info=$(lspci -nn | grep "$pci_addr" || true) pci_info=$(lspci -nn | grep "${pci_addr#0000:}" || true)
name="${pci_info#*: }" name="${pci_info#*: }"
[[ -z "$name" ]] && name="Unknown GPU ($pci_addr)" [[ -z "$name" ]] && name="Unknown GPU ($pci_addr)"

View File

@ -1007,23 +1007,41 @@ function fetch_and_deploy_gh_release() {
local top_dirs local top_dirs
top_dirs=$(find "$unpack_tmp" -mindepth 1 -maxdepth 1 -type d | wc -l) top_dirs=$(find "$unpack_tmp" -mindepth 1 -maxdepth 1 -type d | wc -l)
local top_entries inner_dir
if [[ "$top_dirs" -eq 1 ]]; then top_entries=$(find "$unpack_tmp" -mindepth 1 -maxdepth 1)
if [[ "$(echo "$top_entries" | wc -l)" -eq 1 && -d "$top_entries" ]]; then
# Strip leading folder # Strip leading folder
local inner_dir inner_dir="$top_entries"
inner_dir=$(find "$unpack_tmp" -mindepth 1 -maxdepth 1 -type d)
shopt -s dotglob nullglob shopt -s dotglob nullglob
cp -r "$inner_dir"/* "$target/" if compgen -G "$inner_dir/*" >/dev/null; then
cp -r "$inner_dir"/* "$target/" || {
msg_error "Failed to copy contents from $inner_dir to $target"
rm -rf "$tmpdir" "$unpack_tmp"
return 1
}
else
msg_error "Inner directory is empty: $inner_dir"
rm -rf "$tmpdir" "$unpack_tmp"
return 1
fi
shopt -u dotglob nullglob shopt -u dotglob nullglob
else else
# Copy all contents # Copy all contents
shopt -s dotglob nullglob shopt -s dotglob nullglob
cp -r "$unpack_tmp"/* "$target/" if compgen -G "$unpack_tmp/*" >/dev/null; then
cp -r "$unpack_tmp"/* "$target/" || {
msg_error "Failed to copy contents to $target"
rm -rf "$tmpdir" "$unpack_tmp"
return 1
}
else
msg_error "Unpacked archive is empty"
rm -rf "$tmpdir" "$unpack_tmp"
return 1
fi
shopt -u dotglob nullglob shopt -u dotglob nullglob
fi fi
rm -rf "$unpack_tmp"
### Singlefile Mode ### ### Singlefile Mode ###
elif [[ "$mode" == "singlefile" ]]; then elif [[ "$mode" == "singlefile" ]]; then
local pattern="${6%\"}" local pattern="${6%\"}"