Skip to content

Commit

Permalink
allow specifying UUID= or LABEL= syntax for root
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed May 9, 2011
1 parent aa35bf9 commit 2c40440
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions init.c
Expand Up @@ -690,7 +690,31 @@ static void try_create_root(void) { /* {{{ */

root = getenv("root");

if (strncmp(root, "UUID=", 5) == 0 ||
strncmp(root, "LABEL=", 6) == 0) {
/* resolve UUID= or LABEL= syntax */
char *key, *val, *res;

key = val = root;
strsep(&val, "=");

res = blkid_evaluate_tag(key, val, NULL);
if (!res) {
err("failed to resolve %s to a root device", root);
return;
}
root = res;

/* it may already exist */
if (access(root, F_OK) == 0) {
setenv("root", root, 1);
return;
}
}

/* intentional fallthrough from above */
if (strncmp(root, "/dev/", 5) == 0) {
/* regular block device */
FILE *fp;
char path[PATH_MAX], majmin[8];

Expand Down

0 comments on commit 2c40440

Please sign in to comment.