예제 #1
0
파일: bee-dep.c 프로젝트: fpellanda/bee
static int bee_dep_remove(int argc, char *argv[])
{
    int i, c, help, print;
    struct hash *graph;
    char *pkg;
    struct option long_options[] = {
        {"help",  0, &help,  1},
        {"print", 0, &print, 1},
        {0, 0, 0, 0}
    };

    help = print = 0;

    while ((c = getopt_long(argc, argv, "", long_options, NULL)) != -1) {
        switch (c) {
            case '?':
                usage_remove();
                return 1;
        }
    }

    if (help) {
        usage_remove();
        return 0;
    }

    if (optind == argc) {
        fprintf(stderr, "bee-dep: pkgname needed\n");
        return 1;
    }

    graph = get_cache();

    for (i = optind; i < argc; i++) {
        pkg = argv[i];

        if (print && print_removable(graph, pkg)) {
            hash_free(graph);
            return 1;
        }

        if (remove_package(graph, pkg)) {
            hash_free(graph);
            return 1;
        }
    }

    if (save_cache(graph, cache_filename())) {
        hash_free(graph);
        return 1;
    }

    hash_free(graph);
    return 0;
}
예제 #2
0
파일: main.c 프로젝트: jetspace/logistics
int main(int argc, char **argv)
{
    setlocale(LC_ALL, "" );
    textdomain("logistics");
    int c =0;
    while(( c = getopt_long(argc, argv, ":lhvi:r:uUgx", args, NULL)) != -1)
    {
        switch(c)
        {
	    	case 'h':
				show_help();
				return 0;
	    	break;
	    	case 'v':
				show_version();
				return 0;
	    	break;
            case 'l':
                list_all_packages_to_terminal();
            break;
            case 'i':
               	install_package(optarg);
            break;
            case 'r':
               	remove_package(optarg);
            break;
            case 'u':
               	update_package_db();
            break;
            case 'U':
               	system_upgrade();
            break;
            case 'g':
                gtk_init(&argc, &argv);
                init_gui(argc, argv, 0);
            break;
            case 'x':
                gtk_init(&argc, &argv);
                init_gui(argc, argv, 1);
            break;
			default:
				show_help();
				return 1;
			break;
        }
    }
    return 0;
}
예제 #3
0
파일: remove.cpp 프로젝트: foo/magazyn
int remove(const std::string& package_name, const po::variables_map& config_file)
{
  std::cout << translate("remove_attempt") << " " << package_name << '\n';

  std::string installed_pkgs = config_var("installed_packages", config_file);
  std::string installed_version = package_version(package_name, installed_pkgs);

  if(installed_version == "")
  {
    std::cout << translate("pkg_not_installed") << '\n';
    return 0;
  }

  std::string local = config_var("local", config_file);
  std::string pkg_file = local + package_name + "_" + installed_version + ".tar";
  
  package* pkg = load_package(local + package_name + "_" + installed_version + ".tar");

  if(pkg)
  {
    // wypisanie informacji o pakiecie
     std::cout << translate("removing") << ": " << std::endl
	      << " " << translate("name") << ": " << pkg->name << std::endl
	      << " " << translate("version") << ": " << pkg->version << std::endl
	      << " " << translate("licence") << ": " << pkg->licence << std::endl
	      << " " << translate("description") << ": " << pkg->description << std::endl;

     // wypisanie plików, które zostaną usunięte
    for(std::vector<std::pair<std::string, std::string> >::iterator ins = pkg->files.begin();
	ins != pkg->files.end(); ++ins)
    {
      std::cout << translate("removing") << " " << (*ins).first << " "+ translate("from") << " " <<
	(*ins).second << std::endl;
    }

    // usunięcie pakietu - operacje dyskowe
    remove_package(pkg, config_file);
    
    delete pkg;
  }
  return 0;
}
예제 #4
0
void unpack_package(deb_file_t *deb_file)
{
	const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
	const unsigned int status_num = search_status_hashtable(package_name);
	const unsigned int status_package_num = status_hashtable[status_num]->status;

	FILE *out_stream;
	char *info_prefix;

	/* If existing version, remove it first */
	if (strcmp(name_hashtable[get_status(status_num, 3)], "installed") == 0) {
		/* Package is already installed, remove old version first */
		printf("Preparing to replace %s %s (using %s) ...\n", package_name,
			name_hashtable[package_hashtable[status_package_num]->version],
			deb_file->filename);
		remove_package(status_package_num);
	} else {
		printf("Unpacking %s (from %s) ...\n", package_name, deb_file->filename);
	}

	/* Extract control.tar.gz to /var/lib/dpkg/info/<package>.filename */
	info_prefix = (char *) xmalloc(sizeof(package_name) + 20 + 4 + 1);
	sprintf(info_prefix, "/var/lib/dpkg/info/%s.", package_name);
	deb_extract(deb_file->filename, stdout, (extract_quiet | extract_control_tar_gz | extract_all_to_fs), info_prefix, NULL);

	/* Extract data.tar.gz to the root directory */
	deb_extract(deb_file->filename, stdout, (extract_quiet | extract_data_tar_gz | extract_all_to_fs), "/", NULL);

	/* Create the list file */
	strcat(info_prefix, "list");
	out_stream = xfopen(info_prefix, "w");			
	deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL);
	fclose(out_stream);

	/* change status */
	set_status(status_num, "install", 1);
	set_status(status_num, "unpacked", 3);

	free(info_prefix);
}
예제 #5
0
void yf::LoadBalance::Impl::process(mp::Package &package)
{
    bool is_closed_front = false;

    // checking for closed front end packages
    if (package.session().is_closed())
    {
        is_closed_front = true;
    }

    Z_GDU *gdu_req = package.request().get();

    // passing anything but z3950 packages
    if (gdu_req && gdu_req->which == Z_GDU_Z3950)
    {
        // target selecting only on Z39.50 init request
        if (gdu_req->u.z3950->which == Z_APDU_initRequest)
        {
            yazpp_1::GDU base_req(gdu_req);
            Z_APDU *apdu = base_req.get()->u.z3950;

            Z_InitRequest *org_init = base_req.get()->u.z3950->u.initRequest;
            mp::odr odr_en(ODR_ENCODE);

            std::list<std::string> vhosts;
            mp::util::remove_vhost_otherinfo(&(org_init->otherInfo), vhosts);
            // get lowest of all vhosts.. Remove them if individually if
            // they turn out to be bad..
            while (1)
            {
                std::list<std::string>::iterator ivh = vhosts.begin();
                std::list<std::string>::iterator ivh_pick = vhosts.end();

                Package init_pkg(package.session(), package.origin());
                init_pkg.copy_filter(package);

                unsigned int cost_i = std::numeric_limits<unsigned int>::max();
                {
                    boost::mutex::scoped_lock scoped_lock(m_mutex);

                    for (; ivh != vhosts.end(); ivh++)
                    {
                        if ((*ivh).size() != 0)
                        {
                            unsigned int cost
                                = yf::LoadBalance::Impl::cost(*ivh);

                            std::ostringstream os;
                            os  << "LB" << " "
                                << package << " "
                                << "0.000000" << " "
                                << "Consider " << *ivh
                                << " cost=" << cost;
                            yaz_log(YLOG_LOG, "%s", os.str().c_str());
                            if (cost_i > cost)
                            {
                                ivh_pick = ivh;
                                cost_i = cost;
                            }
                        }
                    }
                }
                if (ivh_pick == vhosts.end())
                    break;
                std::string target = *ivh_pick;
                vhosts.erase(ivh_pick);
                // copying new target into init package
                yazpp_1::GDU init_gdu(base_req);
                Z_InitRequest *init_req = init_gdu.get()->u.z3950->u.initRequest;

                mp::util::set_vhost_otherinfo(&(init_req->otherInfo),
                                              odr_en, target, 1);

                init_pkg.request() = init_gdu;

                // moving all package types
                init_pkg.move();

                // checking for closed back end packages
                if (!init_pkg.session().is_closed())
                {
                    add_session(package.session().id(), target);

                    package.response() = init_pkg.response();
                    return;
                }
                std::ostringstream os;
                os  << "LB" << " "
                    << package << " "
                    << "0.000000" << " "
                    << "Failed " << target;
                yaz_log(YLOG_LOG, "%s", os.str().c_str());
            }
            mp::odr odr;
            package.response() = odr.create_initResponse(
                apdu, YAZ_BIB1_TEMPORARY_SYSTEM_ERROR,
                "load_balance: no available targets");
            package.session().close();
            return;
        }
        // frontend Z39.50 close request is added to statistics and marked
        else if (gdu_req->u.z3950->which == Z_APDU_close)
        {
            is_closed_front = true;
            boost::mutex::scoped_lock scoped_lock(m_mutex);
            add_package(package.session().id());
        }
        // any other Z39.50 package is added to statistics
        else
        {
            boost::mutex::scoped_lock scoped_lock(m_mutex);
            add_package(package.session().id());
        }
    }

    // moving all package types
    package.move();

    bool is_closed_back = false;

    // checking for closed back end packages
    if (package.session().is_closed())
        is_closed_back = true;

    Z_GDU *gdu_res = package.response().get();

    // passing anything but z3950 packages
    if (gdu_res && gdu_res->which == Z_GDU_Z3950)
    {
        // session closing only on Z39.50 close response
        if (gdu_res->u.z3950->which == Z_APDU_close)
        {
            is_closed_back = true;
            boost::mutex::scoped_lock scoped_lock(m_mutex);
            remove_package(package.session().id());
        }
        // any other Z39.50 package is removed from statistics
        else
        {
            boost::mutex::scoped_lock scoped_lock(m_mutex);
            remove_package(package.session().id());
        }
    }

    // finally removing sessions and marking deads
    if (is_closed_back || is_closed_front)
    {
        boost::mutex::scoped_lock scoped_lock(m_mutex);

        // marking backend dead if backend closed without fronted close
        if (is_closed_front == false)
            add_dead(package.session().id());

        remove_session(package.session().id());

        // making sure that package is closed
        package.session().close();
    }
}
예제 #6
0
파일: bee-dep.c 프로젝트: fpellanda/bee
static int bee_dep_update(int argc, char *argv[])
{
    int c, help;
    char *pkg;
    char path[PATH_MAX + 1];
    struct hash *graph;
    struct stat st;
    struct option long_options[] = {
        {"help", 0, &help, 1},
        {0, 0, 0, 0}
    };

    help = 0;

    while ((c = getopt_long(argc, argv, "", long_options, NULL)) != -1) {
        switch (c) {
            case '?':
                usage_update();
                return 1;
        }
    }

    if (help) {
        usage_update();
        return 0;
    }

    if (argc == 1) {
        graph = get_cache();

        if (update_cache(graph) || save_cache(graph, cache_filename())) {
            hash_free(graph);
            return 1;
        }

        hash_free(graph);
        return 0;
    }

    if (argc < 2) {
        fprintf(stderr, "bee-dep: pkgname needed\n");
        return 1;
    }

    if (argc > 2) {
        fprintf(stderr, "bee-dep: too many arguments\n");
        return 1;
    }

    pkg = argv[1];

    if (sprintf(path, "%s/%s/DEPENDENCIES", bee_metadir(), pkg) < 0) {
        perror("bee-dep: sprintf");
        return 1;
    }

    graph = get_cache();

    if (stat(path, &st) != -1) {
        if (hash_search(graph, pkg)) {
            hash_free(graph);
            return 0;
        }

        if (graph_insert_nodes(graph, path)) {
            hash_free(graph);
            return 1;
        }
    } else {
        if (remove_package(graph, pkg)) {
            hash_free(graph);
            return 1;
        }
    }

    if (save_cache(graph, cache_filename())) {
        hash_free(graph);
        return 1;
    }

    hash_free(graph);
    return 0;
}
예제 #7
0
파일: bee-dep.c 프로젝트: fpellanda/bee
static int update_cache(struct hash *graph)
{
    struct dirent **package;
    int i, pkg_cnt;
    char path[PATH_MAX + 1];
    struct stat st;
    struct tree_node *t;

    if (stat(bee_metadir(), &st) == -1)
        return 0;

    if ((pkg_cnt = scandir(bee_metadir(), &package, 0, alphasort)) < 0) {
        perror("bee-dep: update_cache: scandir");
        return 1;
    }

    /* skip . and .. */
    free(package[0]);
    free(package[1]);

    /* add new (not known) packages */
    for (i = 2; i < pkg_cnt; i++) {
        if (hash_search(graph, package[i]->d_name))
            continue;

        printf("adding %s\n", package[i]->d_name);

        if (sprintf(path, "%s/%s", bee_metadir(), package[i]->d_name) < 0) {
            perror("bee-dep: update_cache: sprintf");
            return 1;
        }

        if (stat(path, &st) == -1) {
            perror("bee-dep: update_cache: stat");
            return 1;
        }

        if (S_ISDIR(st.st_mode)) {
            strcat(path, "/DEPENDENCIES");

            if (stat(path, &st) == -1) {
                fprintf(stderr,
                        "bee-dep: update_cache: missing "
                        "DEPENDENCIES file for package \"%s\"\n",
                        package[i]->d_name);
                return 1;
            }

            if (graph_insert_nodes(graph, path))
                return 1;
        }

        free(package[i]);
    }

    free(package);

    /* remove packages which not exist anymore */
    for (i = 0; i < TBLSIZE; i++) {
        t = tree_first(graph->tbl[i]->root);

        while (t) {
            if (IS_PKG(t->n)) {
                if (sprintf(path, "%s/%s", bee_metadir(), t->n->name) < 0) {
                    perror("bee-dep: update_cache: sprintf");
                    return 1;
                }

                if (stat(path, &st) == -1) {
                    printf("removing %s\n", t->n->name);

                    if (remove_package(graph, t->n->name))
                        return 1;
                }
            }

            t = tree_next(t);
        }
    }

    return 0;
}
예제 #8
0
파일: pkg.c 프로젝트: HarryR/sanos
int main(int argc, char *argv[]) {
  struct pkgdb db;
  int c;
  int i;
  int rc;
  int remove = 0;
  int list = 0;
  int query = 0;
  int options = 0;
  int check = 0;

  // Parse command line options
  memset(&db, 0, sizeof(struct pkgdb));
  db.repo = DEFAULT_PKG_REPO;
  while ((c = getopt(argc, argv, "cdflquvBFR:U?")) != EOF) {
    switch (c) {
      case 'c':
        check = 1;
        break;

      case 'd':
        remove = 1;
        break;

      case 'f':
        options |= FROM_FILE;
        break;

      case 'l':
        list = 1;
        break;

      case 'q':
        query = 1;
        break;

      case 'u':
        options |= UPGRADE;
        break;

      case 'v':
        options |= VERBOSE;
        break;

      case 'B':
        options |= ONLY_BUILD;
        break;

      case 'F':
        options |= ONLY_FETCH;
        break;

      case 'R':
        db.repo = optarg;
        break;

      case 'U':
        options |= UPDATE;
        break;

      case '?':
      default:
        usage();
    }
  }
  if (optind == argc && !check && !list && !query && !(options & UPGRADE)) usage();

  // Read package database
  read_pkgdb(&db);

  // Get package timestamps from repository
  if ((options & UPGRADE) || check) {
    if (retrieve_package_timestamps(&db, db.repo) != 0) return 1;
  }

  if (check) {
    // Check for updates
    struct pkg *pkg;
    int num_updates = 0;
    for (pkg = db.head; pkg; pkg = pkg->next) {    
      if (pkg->avail > pkg->time) {
        num_updates++;
        if (options & VERBOSE) {
          printf("pkg: new version of %s available\n", pkg->name);
        }
      }
    }
    if (num_updates > 0) {
      printf("pkg: updates for %d packages available, use 'pkg -u' to update.\n", num_updates);
      rc = 1;
    } else {
      rc = 0;
    }
  } else if (list) {
    // List installed packages
    struct pkg *pkg;
    for (pkg = db.head; pkg; pkg = pkg->next) {
      if (options & VERBOSE) {
        printf("%-15s %s\n", pkg->name, pkg->description ? pkg->description : "");
      } else if (!(options & UPGRADE) || pkg->avail > pkg->time) {
        puts(pkg->name);
      }
    }
    rc = 0;
  } else if (query) {
    // Query package repository
    rc = query_repository(argv + optind, db.repo);
  } else if ((options & UPGRADE) && optind == argc) {
    // Upgrade all packages
    struct pkg *pkg;
    for (pkg = db.head; pkg; pkg = pkg->next) {
      rc = install_package(pkg->name, &db, options);
      if (rc != 0) break;
    }
  } else {
    // Install/remove packages
    for (i = optind; i < argc; i++) {
      if (remove) {
        rc = remove_package(argv[i], &db, options);
      } else {
        rc = install_package(argv[i], &db, options);
      }
      if (rc != 0) break;
    }
  }

  // Write package database
  if (rc == 0 && db.dirty) write_pkgdb(&db);
  delete_pkgdb(&db);

  return rc;
}
예제 #9
0
extern int dpkg_main(int argc, char **argv)
{
	deb_file_t **deb_file = NULL;
	status_node_t *status_node;
	int opt = 0;
	int package_num;
	int dpkg_opt = 0;
	int deb_count = 0;
	int state_status;
	int status_num;
	int i;

	while ((opt = getopt(argc, argv, "CF:ilPru")) != -1) {
		switch (opt) {
			case 'C': // equivalent to --configure in official dpkg
				dpkg_opt |= dpkg_opt_configure;
				dpkg_opt |= dpkg_opt_package_name;
				break;
			case 'F': // equivalent to --force in official dpkg
				if (strcmp(optarg, "depends") == 0) {
					dpkg_opt |= dpkg_opt_force_ignore_depends;
				}				
			case 'i':
				dpkg_opt |= dpkg_opt_install;
				dpkg_opt |= dpkg_opt_filename;
				break;
			case 'l':
				dpkg_opt |= dpkg_opt_list_installed;
			case 'P':
				dpkg_opt |= dpkg_opt_purge;
				dpkg_opt |= dpkg_opt_package_name;
				break;
			case 'r':
				dpkg_opt |= dpkg_opt_remove;
				dpkg_opt |= dpkg_opt_package_name;
				break;
			case 'u':	/* Equivalent to --unpack in official dpkg */
				dpkg_opt |= dpkg_opt_unpack;
				dpkg_opt |= dpkg_opt_filename;
				break;
			default:
				show_usage();
		}
	}

	if ((argc == optind) || (dpkg_opt == 0)) {
		show_usage();
	} 

	puts("(Reading database ... xxxxx files and directories installed.)");
	index_status_file("/var/lib/dpkg/status");

	/* Read arguments and store relevant info in structs */
	deb_file = xmalloc(sizeof(deb_file_t));
	while (optind < argc) {
		deb_file[deb_count] = (deb_file_t *) xmalloc(sizeof(deb_file_t));
		if (dpkg_opt & dpkg_opt_filename) {
			deb_file[deb_count]->filename = xstrdup(argv[optind]);
			deb_file[deb_count]->control_file = deb_extract(argv[optind], stdout, (extract_control_tar_gz | extract_one_to_buffer), NULL, "./control");
			if (deb_file[deb_count]->control_file == NULL) {
				error_msg_and_die("Couldnt extract control file");
			}
			package_num = fill_package_struct(deb_file[deb_count]->control_file);

			if (package_num == -1) {
				error_msg("Invalid control file in %s", argv[optind]);
				continue;
			}
			deb_file[deb_count]->package = (unsigned int) package_num;
			/* Add the package to the status hashtable */
			if ((dpkg_opt & dpkg_opt_unpack) || (dpkg_opt & dpkg_opt_install)) {
				status_node = (status_node_t *) xmalloc(sizeof(status_node_t));
				status_node->package = deb_file[deb_count]->package;
				/* use reinstreq isnt changed to "ok" until the package control info
				 * is written to the status file*/
				status_node->status = search_name_hashtable("install reinstreq not-installed");

				status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
				status_hashtable[status_num] = status_node;
			}
		}
		else if (dpkg_opt & dpkg_opt_package_name) {
			deb_file[deb_count]->filename = NULL;
			deb_file[deb_count]->control_file = NULL;
			deb_file[deb_count]->package = search_package_hashtable(
				search_name_hashtable(argv[optind]),
				search_name_hashtable("ANY"), VER_ANY);
			if (package_hashtable[deb_file[deb_count]->package] == NULL) {
				error_msg_and_die("Package %s is uninstalled or unknown\n", argv[optind]);
			}
			state_status = get_status(search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]), 3);

			/* check package status is "installed" */
			if (dpkg_opt & dpkg_opt_remove) {
				if ((strcmp(name_hashtable[state_status], "not-installed") == 0) ||
					(strcmp(name_hashtable[state_status], "config-files") == 0)) {
					error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
				}
			}
			else if (dpkg_opt & dpkg_opt_purge) {
				/* if package status is "conf-files" then its ok */
				if (strcmp(name_hashtable[state_status], "not-installed") == 0) {
					error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
				}
			}
		}
		deb_count++;
		optind++;
	}
	deb_file[deb_count] = NULL;

	/* Check that the deb file arguments are installable */
	/* TODO: check dependencies before removing */
	if ((dpkg_opt & dpkg_opt_force_ignore_depends) != dpkg_opt_force_ignore_depends) {
		if (!check_deps(deb_file, 0, deb_count)) {
			error_msg_and_die("Dependency check failed");
		}
	}

	for (i = 0; i < deb_count; i++) {
		/* Remove or purge packages */
		if (dpkg_opt & dpkg_opt_remove) {
			remove_package(deb_file[i]->package);
		}
		else if (dpkg_opt & dpkg_opt_purge) {
			purge_package(deb_file[i]->package);
		}
		else if (dpkg_opt & dpkg_opt_unpack) {
			unpack_package(deb_file[i]);
		}
		else if (dpkg_opt & dpkg_opt_install) {
			unpack_package(deb_file[i]);
			configure_package(deb_file[i]);
		}
		else if (dpkg_opt & dpkg_opt_configure) {
			configure_package(deb_file[i]);
		}
	}

	write_status_file(deb_file);

	for (i = 0; i < deb_count; i++) {
		free(deb_file[i]->control_file);
		free(deb_file[i]->filename);
		free(deb_file[i]);
	}
	free(deb_file);

	for (i = 0; i < NAME_HASH_PRIME; i++) {
		if (name_hashtable[i] != NULL) {
			free(name_hashtable[i]);
		}
	}

	for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
		free_package(package_hashtable[i]);
	}

	for (i = 0; i < STATUS_HASH_PRIME; i++) {
		if (status_hashtable[i] != NULL) {
			free(status_hashtable[i]);
		}
	}

	return(EXIT_FAILURE);
}
int main() {
  int retval;
  char dev[1024];
  int i=0;

  printf("elh\n");

  if (getuid() != 0) {
    printf("not running as root\n");
    exit(1);
  }

  populate_installed_packages();

  while (packages[i][0] != '\0') {
    if (package_installed(packages[i]) != -1) {
      remove_package(packages[i], i);
    }
    i++;
  }

  getSystemMountPoint(dev);

  errno = 0;
  retval = mount(dev, "/system", "ignored", MS_REMOUNT, NULL);
  llog("mnt rw", retval);

  if (retval != 0) {
    // no use continuing if we can't remount read-write
    exit(1);
  }

  if (file_exists("/system/app/DownloadProvidersManager.apk")) {
    errno = 0;
    retval = unlink("/system/app/DownloadProvidersManager.apk");
    llog("rm DownloadProvidersManager", retval);

    errno = 0;
    printf("pm uninst downloadsmanager:");
    fflush(stdout);
    system("/system/bin/pm uninstall com.android.providers.downloadsmanager");
  }

  if (file_exists("/system/app/com.android.providers.ammanage.apk")) {
    errno = 0;
    retval = unlink("/system/app/com.android.providers.ammanage.apk");
    llog("rm ammanager", retval);

    errno = 0;
    printf("pm uninst ammanager:");
    fflush(stdout);
    system("/system/bin/pm uninstall com.android.providers.ammanage");
  }

  if (file_exists("/system/bin/profile")) {
    errno = 0;
    retval = unlink("/system/bin/profile");
    llog("rm profile", retval);
  }

  if (file_exists("/system/bin/share")) {
    errno = 0;
    retval = unlink("/system/bin/share");
    llog("rm share", retval);
  }

  /*
   * technically it's ok if the next line fails, as the
   * filesystem will be mounted read-only on the next boot
   */
  errno = 0;
  retval = mount(dev, "/system", "ignored", MS_REMOUNT | MS_RDONLY, NULL);
  llog("mnt ro", retval);

  return 0;
}