return $PKG_ERROR
}
+resolve_file_mode_id() {
+ type="$1"
+ name="$2"
+ position=1
+ if [ "$type" = "group" ]; then
+ position=2
+ fi
+
+ # root is always 0
+ if [ "$name" = "root" ]; then
+ echo 0
+ exit 0
+ fi
+
+ # return numeric names
+ if [ "$name" -eq "$name" 2>/dev/null ]; then
+ echo "$name"
+ exit 0
+ fi
+
+ ids=$(grep "$name" "$TOPDIR/tmp/userids")
+ for id in $ids; do
+ resolved_name=$(echo "$id" | cut -d ":" -f "$position" | cut -d "=" -f 1)
+ resolved_id=$(echo "$id" | cut -d ":" -f "$position" | cut -d "=" -f 2)
+ if [ "$resolved_name" = "$name" ]; then
+ echo "$resolved_id"
+ exit 0
+ fi
+ done
+
+ >&2 echo "No $type ID found for $name"
+ exit 1
+}
+
###
# ipkg-build "main"
###
;;
esac
path=$(echo "$file_mode" | cut -d ':' -f 1)
- user_group=$(echo "$file_mode" | cut -d ':' -f 2-3)
+ user=$(echo "$file_mode" | cut -d ':' -f 2)
+ group=$(echo "$file_mode" | cut -d ':' -f 3)
mode=$(echo "$file_mode" | cut -d ':' -f 4)
- chown "$user_group" "$pkg_dir/$path"
+ uid=$(resolve_file_mode_id user "$user")
+ gid=$(resolve_file_mode_id group "$group")
+
+ chown "$uid:$gid" "$pkg_dir/$path"
chmod "$mode" "$pkg_dir/$path"
done
$TAR -X $tmp_dir/tarX --format=gnu --sort=name -cpf - --mtime="$TIMESTAMP" . | $GZIP -n - > $tmp_dir/data.tar.gz