Create filesystem indices when creating Haiku image
Fixes #4424. Change-Id: I737ee4f9bb70ce48c0c94f3a862a3073da8c0c4d Reviewed-on: https://review.haiku-os.org/c/haiku/+/2796 Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
77912444b8
commit
c5aa9dfb4c
@@ -77,6 +77,7 @@ if [ $isCD ]; then
|
|||||||
ln=ln
|
ln=ln
|
||||||
mkdir=mkdir
|
mkdir=mkdir
|
||||||
rm=rm
|
rm=rm
|
||||||
|
mkindex="mkindex -d $tPrefix"
|
||||||
elif [ $isImage ]; then
|
elif [ $isImage ]; then
|
||||||
# If FIFOs are used for the communication with the FS shell, prepare them.
|
# If FIFOs are used for the communication with the FS shell, prepare them.
|
||||||
if $fsShellCommand --uses-fifos; then
|
if $fsShellCommand --uses-fifos; then
|
||||||
@@ -145,7 +146,7 @@ else
|
|||||||
ln=ln
|
ln=ln
|
||||||
mkdir=mkdir
|
mkdir=mkdir
|
||||||
rm=rm
|
rm=rm
|
||||||
mkindex=mkindex
|
mkindex="mkindex -d $tPrefix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -291,6 +292,45 @@ if [ -n "$updateAllPackages" ]; then
|
|||||||
$mkdir -p "${tPrefix}system/packages"
|
$mkdir -p "${tPrefix}system/packages"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Creating filesystem indices..."
|
||||||
|
$mkindex -t string Audio:Album
|
||||||
|
$mkindex -t string Audio:Artist
|
||||||
|
$mkindex -t string Media:Genre
|
||||||
|
$mkindex -t string Media:Title
|
||||||
|
$mkindex -t string MAIL:account
|
||||||
|
$mkindex -t string MAIL:cc
|
||||||
|
$mkindex -t string MAIL:chain
|
||||||
|
$mkindex -t string MAIL:draft
|
||||||
|
$mkindex -t string MAIL:flags
|
||||||
|
$mkindex -t string MAIL:from
|
||||||
|
$mkindex -t string MAIL:name
|
||||||
|
$mkindex -t string MAIL:pending_chain
|
||||||
|
$mkindex -t string MAIL:priority
|
||||||
|
$mkindex -t string MAIL:reply
|
||||||
|
$mkindex -t string MAIL:status
|
||||||
|
$mkindex -t string MAIL:subject
|
||||||
|
$mkindex -t string MAIL:thread
|
||||||
|
$mkindex -t string MAIL:to
|
||||||
|
$mkindex -t string META:address
|
||||||
|
$mkindex -t string META:city
|
||||||
|
$mkindex -t string META:company
|
||||||
|
$mkindex -t string META:county
|
||||||
|
$mkindex -t string META:email
|
||||||
|
$mkindex -t string META:fax
|
||||||
|
$mkindex -t string META:group
|
||||||
|
$mkindex -t string META:hphone
|
||||||
|
$mkindex -t string META:name
|
||||||
|
$mkindex -t string META:nickname
|
||||||
|
$mkindex -t string META:state
|
||||||
|
$mkindex -t string META:url
|
||||||
|
$mkindex -t string META:wphone
|
||||||
|
$mkindex -t string META:zip
|
||||||
|
|
||||||
|
$mkindex -t int32 Media:Rating
|
||||||
|
$mkindex -t int32 Media:Year
|
||||||
|
$mkindex -t int32 MAIL:account_id
|
||||||
|
$mkindex -t int32 MAIL:read
|
||||||
|
$mkindex -t int32 MAIL:when
|
||||||
|
|
||||||
echo "Populating image ..."
|
echo "Populating image ..."
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
|
|||||||
@@ -1007,12 +1007,27 @@ command_mkdir(int argc, const char* const* argv)
|
|||||||
static fssh_status_t
|
static fssh_status_t
|
||||||
command_mkindex(int argc, const char* const* argv)
|
command_mkindex(int argc, const char* const* argv)
|
||||||
{
|
{
|
||||||
if (argc != 2) {
|
if (argc < 2) {
|
||||||
fprintf(stderr, "Usage: %s <index name>\n", argv[0]);
|
fprintf(stderr, "Usage: %s [-t <type>] <index name>\n", argv[0]);
|
||||||
return FSSH_B_BAD_VALUE;
|
return FSSH_B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* indexName = argv[1];
|
int fileArg = 1;
|
||||||
|
int type = FSSH_B_STRING_TYPE;
|
||||||
|
|
||||||
|
if (argc > 3 && strcmp(argv[1], "-t") == 0) {
|
||||||
|
fileArg = 3;
|
||||||
|
if (strcmp(argv[2], "string") == 0)
|
||||||
|
type = FSSH_B_STRING_TYPE;
|
||||||
|
else if (strcmp(argv[2], "int32") == 0)
|
||||||
|
type = FSSH_B_INT32_TYPE;
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "Unhandled attribute type %s\n", argv[2]);
|
||||||
|
return FSSH_B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* indexName = argv[fileArg];
|
||||||
|
|
||||||
// get the volume ID
|
// get the volume ID
|
||||||
fssh_dev_t volumeID = get_volume_id();
|
fssh_dev_t volumeID = get_volume_id();
|
||||||
@@ -1020,8 +1035,7 @@ command_mkindex(int argc, const char* const* argv)
|
|||||||
return volumeID;
|
return volumeID;
|
||||||
|
|
||||||
// create the index
|
// create the index
|
||||||
fssh_status_t error =_kern_create_index(volumeID, indexName,
|
fssh_status_t error =_kern_create_index(volumeID, indexName, type, 0);
|
||||||
FSSH_B_STRING_TYPE, 0);
|
|
||||||
if (error != FSSH_B_OK) {
|
if (error != FSSH_B_OK) {
|
||||||
fprintf(stderr, "Error: Failed to create index \"%s\": %s\n",
|
fprintf(stderr, "Error: Failed to create index \"%s\": %s\n",
|
||||||
indexName, fssh_strerror(error));
|
indexName, fssh_strerror(error));
|
||||||
|
|||||||
Reference in New Issue
Block a user