progress 12/16
This commit is contained in:
parent
e552cb468b
commit
71117b2fcd
41
etc/glacier.cfg
Normal file
41
etc/glacier.cfg
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# glacier.cfg
|
||||||
|
# The settings defined in this file will be loaded when Glacier is called.
|
||||||
|
# For more information on this file, see https://www.everestlinux.org/docs/intro-to-glacier
|
||||||
|
#
|
||||||
|
|
||||||
|
# Services
|
||||||
|
# Whether Glacier will allow external service files to be called
|
||||||
|
# WARNING: Services may pose a security risk to your system. Only use services you trust.
|
||||||
|
GLACIER_ALLOW_SERVICES = false;
|
||||||
|
|
||||||
|
# Permitted software licenses
|
||||||
|
# When installing a package, Glacier will check its license. If said license is listed here,
|
||||||
|
# it will proceed with the installation. Otherwise, it'll return an error.
|
||||||
|
# For more information on licenses listed below, see https://www.everestlinux.org/docs/intro-to-glacier
|
||||||
|
# Some common license names with their designation codes are:
|
||||||
|
# - GNU General Public License (GPL)
|
||||||
|
# - MIT License (MIT)
|
||||||
|
# - BSD License (BSD)
|
||||||
|
# - Apache license (APACHE)
|
||||||
|
# - Binary-redistributable software (BIN-REDIST)
|
||||||
|
# - End-user-license-agreement (EULA)
|
||||||
|
# If, for any reason, a package uses a custom license, you can simply add it to this list.
|
||||||
|
GLACIER_ALLOWED_LICENSES = [ "GPL", "MIT", "BSD", "APACHE" ];
|
||||||
|
|
||||||
|
# Package integrity checking
|
||||||
|
# WARNING: It is strongly recommended to keep this enabled.
|
||||||
|
# This ensures all incoming packages are not tampered with.
|
||||||
|
GLACIER_DO_INT_CHECK = true;
|
||||||
|
|
||||||
|
# Verbose logging
|
||||||
|
# Enable this option to see exta verbosity.
|
||||||
|
GLACIER_VERBOSE = false;
|
||||||
|
|
||||||
|
# Profile-specific settings
|
||||||
|
# WARNING: The settings below are tied into the system's profile. Changing any of these manually
|
||||||
|
# will certainly cause breakage.
|
||||||
|
# If, for any reason, you must change any of these settings, use `glacier-mkprofile`.
|
||||||
|
# Profile migration may cause breakage. Doing a clean install is the preferred method for changing profiles.
|
||||||
|
|
||||||
|
@include "/etc/glacier/profile.cfg";
|
24
etc/profile.cfg
Normal file
24
etc/profile.cfg
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# profile.cfg
|
||||||
|
# The settings defined in this file descirbe the system's profile.
|
||||||
|
# For more information on this file, see https://www.everestlinux.org/docs/intro-to-glacier
|
||||||
|
#
|
||||||
|
|
||||||
|
# Package Repository
|
||||||
|
# This is the URL which glacier-update-pkgdb will clone to the localdb
|
||||||
|
GLACIER_REPO = "";
|
||||||
|
|
||||||
|
# System architecture
|
||||||
|
# The architecture of your system's CPU
|
||||||
|
GLACIER_ARCH = "";
|
||||||
|
|
||||||
|
# Target compulation triplet
|
||||||
|
# The triplet to be used during compilation, if cross compilation must be invoked
|
||||||
|
GLACIER_TARGET = "";
|
||||||
|
|
||||||
|
# System profile
|
||||||
|
# This variable tells Glacier about your system and which packages can be installed.
|
||||||
|
# This setting depends on the three above and should not be changed manually.
|
||||||
|
# If you wixh to migrate system profiles, see https://www.everestlinux.org/docs/musl-or-glibc
|
||||||
|
GLACIER_SYSTEM_PROFILE = "";
|
||||||
|
|
BIN
src/glacier-mkprofile
Executable file
BIN
src/glacier-mkprofile
Executable file
Binary file not shown.
185
src/glacier-mkprofile.c
Normal file
185
src/glacier-mkprofile.c
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
* glacier-mkprofile.c - Create and modify the system profile
|
||||||
|
*
|
||||||
|
* This file is part of Glacier.
|
||||||
|
*
|
||||||
|
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with Glacier. If
|
||||||
|
* not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <color.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <libconfig.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <glacier_config.h>
|
||||||
|
#include <glacier_log.h>
|
||||||
|
#include <glacier_pkgops.h>
|
||||||
|
#include <glacier_runtime.h>
|
||||||
|
|
||||||
|
#include "glacier.h"
|
||||||
|
|
||||||
|
const wchar_t w_check = 0x2713;
|
||||||
|
|
||||||
|
int iprofile;
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf(COL_BLUE "[*] " COL_RESET "%s - create and modify the system profile\n", argv[0]);
|
||||||
|
printf(COL_BLUE "[?] " COL_RESET "usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]);
|
||||||
|
printf("\n");
|
||||||
|
printf("%s {-h} Show this message\n", argv[0]);
|
||||||
|
printf("%s {-v} Show the current version\n", argv[0]);
|
||||||
|
printf("%s {-l} List available system profiles\n", argv[0]);
|
||||||
|
printf("%s {-p} PROFILE Create or update the system profile PROFILE at /etc/glacier/profile.cfg\n", argv[0]);
|
||||||
|
printf("\n");
|
||||||
|
printf("Glacier is free software.\n");
|
||||||
|
printf("See the GNU GPL version 3 for details.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_small(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf(COL_RED "[x] " COL_RESET "usage: %s [-h] [-v] [-l] [-p]\n", argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
printf(COL_RED "[x] " COL_RESET "%s: not enough arguments (expected 1, got %i)\n", argv[0], argc - 1);
|
||||||
|
usage_small(argc, argv);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
|
int opt;
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "hvlp:")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'h':
|
||||||
|
usage(argc, argv);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
printf(GLACIER_VERSION "\n");
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
infolog("Available profiles:");
|
||||||
|
printf("1)\tx86_64-musl\n");
|
||||||
|
printf("\t");
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
if (argc < 3) { errlog("No system profile specified.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_process_root("Cannot access the system profile: permission denied. Are you root?");
|
||||||
|
|
||||||
|
if (strcmp(optarg, "x86_64-musl") == 0) {
|
||||||
|
infolog ("Using system profile \"x86_64-musl\"");
|
||||||
|
iprofile = 1;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, COL_RED "[x] " COL_RESET "System profile %s is unknown or not supported.\n", optarg);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access("/etc/glacier/profile.cfg", F_OK != 0)) {
|
||||||
|
infolog("No profile exists, skipping backup...");
|
||||||
|
} else if (access("/etc/glacier/profile.cfg", F_OK == 0) && access("/etc/glacier/profile.old", F_OK != 0)) {
|
||||||
|
infolog("Creating backup of old system profile at /etc/glacier/profile.old...");
|
||||||
|
|
||||||
|
if (remove("/etc/glacier/profile.old") == 0) {
|
||||||
|
infolog("Removed old backup.");
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *oldprofile, *oldprofile_back;
|
||||||
|
char filename[128], contents;
|
||||||
|
oldprofile = fopen("/etc/glacier/profile.cfg", "r");
|
||||||
|
oldprofile_back = fopen("/etc/glacier/profile.old", "a+");
|
||||||
|
contents = fgetc(oldprofile);
|
||||||
|
|
||||||
|
while (contents != EOF) {
|
||||||
|
fputc(contents, oldprofile_back);
|
||||||
|
contents = fgetc(oldprofile);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(oldprofile);
|
||||||
|
fclose(oldprofile_back);
|
||||||
|
|
||||||
|
successlog("Successfully created backup.");
|
||||||
|
}
|
||||||
|
|
||||||
|
infolog("Creating new profile configuration file...");
|
||||||
|
static const char *newprofile = "/etc/glacier/profile.cfg";
|
||||||
|
config_t pprofile;
|
||||||
|
config_setting_t *setting, *root;
|
||||||
|
|
||||||
|
config_init(&pprofile);
|
||||||
|
|
||||||
|
root = config_root_setting(&pprofile);
|
||||||
|
|
||||||
|
if (iprofile == 1) {
|
||||||
|
infolog("Writing configuration to file...");
|
||||||
|
|
||||||
|
setting = config_setting_add(root, "GLACIER_REPO", CONFIG_TYPE_STRING);
|
||||||
|
config_setting_set_string(setting, "https://git.everestlinux.org/EverestLinux/epkgs-x86_64-musl");
|
||||||
|
printf("\tGLACIER_REPO = \"https://git.everestlinux.org/EverestLinux/epkgs-x86_64-musl\";\n");
|
||||||
|
|
||||||
|
setting = config_setting_add(root, "GLACIER_ARCH", CONFIG_TYPE_STRING);
|
||||||
|
config_setting_set_string(setting, "x86_64");
|
||||||
|
printf("\tGLACIER_ARCH = \"x86_64\";\n");
|
||||||
|
|
||||||
|
setting = config_setting_add(root, "GLACIER_TARGET", CONFIG_TYPE_STRING);
|
||||||
|
config_setting_set_string(setting, "x86_64-linux-musl");
|
||||||
|
printf("\tGLACIER_TARGET = \"x86_64-linux-musl\";\n");
|
||||||
|
|
||||||
|
setting = config_setting_add(root, "GLACIER_LOCALDB", CONFIG_TYPE_STRING);
|
||||||
|
config_setting_set_string(setting, "/glacier/localdb/epkgs-x86_64-musl");
|
||||||
|
printf("\tGLACIER_LOCALDB = \"/glacier/localdb/epkgs-x86_64-musl\";\n");
|
||||||
|
|
||||||
|
setting = config_setting_add(root, "GLACIER_SYSTEM_PROFILE", CONFIG_TYPE_STRING);
|
||||||
|
config_setting_set_string(setting, "x86_64-musl");
|
||||||
|
printf("\tGLACIER_SYSTEM_PROFILE = \"x86_64-musl\";\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! config_write_file(&pprofile, newprofile)) {
|
||||||
|
errlog("Error while applying new profile to configuration.");
|
||||||
|
config_destroy(&pprofile);
|
||||||
|
return(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
successlog("Successfully updated system profile.");
|
||||||
|
config_destroy(&pprofile);
|
||||||
|
return(EXIT_SUCCESS);
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]);
|
||||||
|
usage_small(argc, argv);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]);
|
||||||
|
usage_small(argc, argv);
|
||||||
|
return 1;
|
||||||
|
}
|
BIN
src/glacier-update-pkgdb
Executable file
BIN
src/glacier-update-pkgdb
Executable file
Binary file not shown.
79
src/glacier-update-pkgdb.c
Normal file
79
src/glacier-update-pkgdb.c
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* glacier-update-pkgdb.c - Update the local package database
|
||||||
|
*
|
||||||
|
* This file is part of Glacier.
|
||||||
|
*
|
||||||
|
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with Glacier. If
|
||||||
|
* not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <color.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <libconfig.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <glacier_config.h>
|
||||||
|
#include <glacier_log.h>
|
||||||
|
#include <glacier_pkgops.h>
|
||||||
|
#include <glacier_runtime.h>
|
||||||
|
|
||||||
|
#include "glacier.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf(COL_BLUE "[*] " COL_RESET "%s - update the local package database\n", argv[0]);
|
||||||
|
printf(COL_BLUE "[?] " COL_RESET "usage: %s [-h] [-v] [-u]\n", argv[0]);
|
||||||
|
printf("\n");
|
||||||
|
printf("%s {-h} Show this messsage\n", argv[0]);
|
||||||
|
printf("%s {-v} Show the current version\n", argv[0]);
|
||||||
|
printf("%s {-u} Update the local database\n", argv[0]);
|
||||||
|
printf("\n");
|
||||||
|
printf("Glacier is free software.\n");
|
||||||
|
printf("See the GNU GPL version 3 for details.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_small(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf(COL_RED "[x] " COL_RESET "usage: %s [-h] [-v] [-u]\n", argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
printf(COL_RED "[x] " COL_RESET "%s: not enough arguments (expected 1, got %i)\n", argv[0], argc - 1);
|
||||||
|
usage_small(argc, argv);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int opt;
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "hvu:")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'h':
|
||||||
|
usage(argc, argv);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
printf(GLACIER_VERSION "\n");
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
src/glacier.h
Normal file
25
src/glacier.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* glacier.h - Operate on the user package index
|
||||||
|
*
|
||||||
|
* This file is patr of Glacier.
|
||||||
|
*
|
||||||
|
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with Glacier. If
|
||||||
|
* not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GLACIER_H_
|
||||||
|
#define GLACIER_H_
|
||||||
|
|
||||||
|
#define GLACIER_VERSION "4.0.0rc"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
105
src/gpkg.c
105
src/gpkg.c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* gpkg.c - Operate on the user package index
|
* gpkg.c - Operate on the user package index
|
||||||
*
|
*
|
||||||
* This file is patr of Glacier.
|
* This file is part of Glacier.
|
||||||
*
|
*
|
||||||
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
* GNU General Public License as published by the Free Software Foundation, either
|
* GNU General Public License as published by the Free Software Foundation, either
|
||||||
@ -15,30 +15,31 @@
|
|||||||
* not, see <https://www.gnu.org/licenses/>.
|
* not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <color.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/*
|
#include <glacier_config.h>
|
||||||
#include <glacier/glacier_config.h>
|
#include <glacier_log.h>
|
||||||
#include <glacier/glacier_log.h>
|
#include <glacier_pkgops.h>
|
||||||
#include <glacier/glacier_pkgops.h>
|
#include <glacier_runtime.h>
|
||||||
#include <glacier/glacier_runtime.h>
|
|
||||||
|
|
||||||
#include "gpkg.h"
|
#include "glacier.h"
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(int argc, char *argv[])
|
usage(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("%s - operate on the user package index\n", argv[0]);
|
printf(COL_BLUE "[*] " COL_RESET "%s - operate on the user package index\n", argv[0]);
|
||||||
printf("usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]);
|
printf(COL_BLUE "[?] " COL_RESET "usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("%s {-h} Show this message\n", argv[0]);
|
printf("%s {-h} Show this message\n", argv[0]);
|
||||||
printf("%s {-v} Show the current version\n", argv[0]);
|
printf("%s {-v} Show the current version\n", argv[0]);
|
||||||
printf("%s {-f} PKG Install package PKG\n", argv[0]);
|
printf("%s {-f} PKG Install package PKG\n", argv[0]);
|
||||||
printf("%s {-u} PKG Update package PKG\n", argv[0]);
|
printf("%s {-u} PKG Update package PKG\n", argv[0]);
|
||||||
printf("%s {-x} PKG Remove package PKG\n", argv[0]);
|
printf("%s {-x} PKG Remove package PKG\n", argv[0]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Glacier is free software.\n");
|
printf("Glacier is free software.\n");
|
||||||
printf("See the GNU GPL version 3 for details.\n");
|
printf("See the GNU GPL version 3 for details.\n");
|
||||||
@ -47,45 +48,65 @@ usage(int argc, char *argv[])
|
|||||||
static void
|
static void
|
||||||
usage_small(int argc, char *argv[])
|
usage_small(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]);
|
printf(COL_RED "[x] " COL_RESET "usage: %s [-h] [-v] [-f] [-u] [-x]\n", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
|
printf(COL_RED "[x] " COL_RESET "%s: not enough arguments (expected 1, got %i)\n", argv[0], argc - 1);
|
||||||
usage_small(argc, argv);
|
usage_small(argc, argv);
|
||||||
return 1;
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, ":if:hvfux")) != -1) {
|
while ((opt = getopt(argc, argv, "hvfux:")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
/* printf(GPKG_VERSION "\n"); */
|
printf(GLACIER_VERSION "\n");
|
||||||
printf("v4.0.0\n");
|
return 0;
|
||||||
return 0;
|
break;
|
||||||
break;
|
case 'f':
|
||||||
case 'f':
|
if (argc < 3) { errlog("No package(s) specified."); return 1; }
|
||||||
return 0;
|
if (is_process_root() == 0) {
|
||||||
break;
|
errlog("Failed to open package index: permission denied. Are you root?");
|
||||||
case 'u':
|
return(EXIT_FAILURE);
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
case 'x':
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
case '?':
|
|
||||||
usage_small(argc, argv);
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
runtime_exists();
|
||||||
|
if (errno != 0) { exit(1); }
|
||||||
|
init_config();
|
||||||
|
load_all_from_config();
|
||||||
|
mkworkspace();
|
||||||
|
die_config();
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
if (argc < 3) { errlog("No package(s) specified."); return 1; }
|
||||||
|
is_process_root("Failed to open package index: permission denied. Are you root?");
|
||||||
|
mkworkspace();
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 'x':
|
||||||
|
if (argc < 3) { errlog("No package(s) specified."); return 1; }
|
||||||
|
is_process_root("Failed to open package index: permission denied. Are you root?");
|
||||||
|
mkworkspace();
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]);
|
||||||
|
usage_small(argc, argv);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
printf(COL_RED "[x] " COL_RESET "%s: Unknown argument '%s'.\n", argv[0], argv[1]);
|
||||||
|
usage_small(argc, argv);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user