Page MenuHomeSoftware Heritage

rm-oversize-from-origin

Authored By
zack
Nov 3 2017, 2:35 PM
Size
659 B
Subscribers
None

rm-oversize-from-origin

#!/bin/bash
oversize_list="/srv/storage/space/lists/oversize-contents.txt.xz"
objstorage_root="/srv/softwareheritage/objects"
oversize_root="/srv/softwareheritage/oversize-objects"
dry_run="y"
act () {
if [ "$dry_run" = "y" ] ; then
echo "* dry run: $@"
else
"$@"
fi
}
warn () {
echo "* WARNING: $1"
}
xzcat "$oversize_list" |
while read obj_id ; do
old_path="${objstorage_root}/${obj_id:0:2}/${obj_id:2:2}/${obj_id:4:2}/${obj_id}"
new_path="${oversize_root}/${obj_id:0:2}/${obj_id:2:2}/${obj_id}"
if ! [ -f "$new_path" ] ; then
warn "$obj_id is missing from oversize storage, not removing"
continue
else
act rm "$old_path"
fi
done

File Metadata

Mime Type
text/x-shellscript
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
204802

Event Timeline

zack changed the visibility from "zack (Stefano Zacchiroli)" to "Public (No Login Required)".Nov 3 2017, 2:37 PM