add finishing touches for v4.0.3-rc

This commit is contained in:
Liam Waldron 2024-12-28 13:04:11 -05:00
parent d10dcd190b
commit e69b9c1197
6 changed files with 119 additions and 116 deletions

View File

@ -1 +1 @@
4.0.0-rc7 4.0.3-rc

21
etc/make.conf Normal file
View File

@ -0,0 +1,21 @@
#
# make.conf
# The settings defined in this file will be loaded when 'make' is called during a Glacier operation.
# For more information on this file, see https://www.everestlinux.org/docs/intro-to-glacier
#
# Number of parallel makejobs. By default this is set by nproc and should be optimal for your system.
MAKEFLAGS="-j$(nproc)"
# Build and compile flags for C and C++ programs.
# Using too many build flags will break packages. Disable these if packages are breaking.
CFLAGS="-O2"
CXXFLAGS="${CFLAGS}"
# Treat all warnings as errors
# Not recommended, as many packages with larger codebases may refuse to compile.
#CFLAGS="-Werror"
# Prefix for packages to be installed.
# Not all packages will honor this.
PREFIX="/usr"

View File

@ -22,6 +22,10 @@ extern config_t cfg;
extern config_setting_t *setting; extern config_setting_t *setting;
extern const char str; extern const char str;
extern char GLACIER_ALLOWED_LICENSES;
extern int GLACIER_DO_INT_CHECK;
extern int GLACIER_VERBOSE;
extern const char *GLACIER_REPO; extern const char *GLACIER_REPO;
extern const char *GLACIER_ARCH; extern const char *GLACIER_ARCH;
extern const char *GLACIER_TARGET; extern const char *GLACIER_TARGET;
@ -30,4 +34,7 @@ extern const char *GLACIER_SYSTEM_PROFILE;
const char *runtime_files[]; const char *runtime_files[];
extern FILE *expected_hash;
extern FILE *pkg;
#endif #endif

View File

@ -33,6 +33,6 @@
* compare_file_hash("pkg.sha256sum", "pkg.tar.xz"); * compare_file_hash("pkg.sha256sum", "pkg.tar.xz");
*/ */
int compare_file_hash(char ORIG_HASH[], char FILE[]); /* int compare_file_hash(char ORIG_HASH[], char FILE[]); */
#endif #endif

View File

@ -37,44 +37,63 @@
#define MAX_CHILDREN 64 #define MAX_CHILDREN 64
#define MAX_SIZE 256 #define MAX_SIZE 256
/* Global variables */ /*
* Global Variables
*
* Descriptions are given as comments after the variable declaration.
* DEFINED IN: globals.h
*
*/
config_t cfg; config_t cfg; /* Context for libconfig */
config_setting_t *setting; config_setting_t *setting; /* Pointer for setting */
const char str; const char str; /* Unsure what this does, will possibly remove later */
int GLACIER_ALLOW_SERVICES; int GLACIER_ALLOW_SERVICES; /* Declaration of GLACIER_ALLOW_SERVICES as given in glacier.cfg */
char GLACIER_ALLOWED_LICENSES; char GLACIER_ALLOWED_LICENSES; /* Declaration of GLACIER_ALLOWED_LICENSES as given in glacier.cfg */
int GLACIER_DO_INT_CHECK; int GLACIER_DO_INT_CHECK; /* Declaration of GLACIER_DO_INT_CHECK as given in glacier.cfg */
int GLACIER_VERBOSE; int GLACIER_VERBOSE; /* Declaration of GLACIER_VERBOSE as given in glacier.cfg */
const char *GLACIER_REPO; const char *GLACIER_REPO; /* Declaration of GLACIER_REPO as defined in profile.cfg */
const char *GLACIER_ARCH; const char *GLACIER_ARCH; /* Declaration of GLACIER_ARCH as defined in profile.cfg */
const char *GLACIER_TARGET; const char *GLACIER_TARGET; /* Declaration of GLACIER_TARGET as defined in profile.cfg */
const char *GLACIER_LOCALDB; const char *GLACIER_LOCALDB; /* Declaration of GLACIER_LOCALDB as defined in profile.cfg */
const char *GLACIER_SYSTEM_PROFILE; const char *GLACIER_SYSTEM_PROFILE; /* Declaration of GLACIER_SYSTEM_PROFILE as defined in profile.cfg */
/* Required runtime files */
const char *runtime_files[] = { const char *runtime_files[] = {
"/etc/glacier.cfg", "/etc/glacier.cfg",
"/etc/glacier/call-hooks", "/etc/glacier/call-hooks",
"/etc/make.conf" "/etc/make.conf"
}; };
FILE *expected_hash; /* File pointer for expected hash */
FILE *pkg; /* File pointer for package hash */
/*
* END GLOBAL VARIABLES
*/
/*
* node
*
* DESCRIPTION: Definition of node type.
* DEFINED IN: data.h
*
*/
struct node { struct node {
char *data; char *data;
struct node *children[MAX_CHILDREN]; struct node *children[MAX_CHILDREN];
int numChildren; int numChildren;
}; };
FILE *expected_hash;
FILE *pkg;
/* /*
* infolog * infolog
* *
* DESCRIPTION: Output a stylized info message. * DESCRIPTION: Output a stylized info message.
* PARAMETERS: char MSG[] * PARAMETERS: char MSG[]
* DEFINED IN: glacier_log.h * DEFINED IN: log.h
* *
*/ */
@ -94,7 +113,7 @@ infolog(char MSG[])
* *
* DESCRIPTION: Output a stylized warning message. * DESCRIPTION: Output a stylized warning message.
* Parameters: char MSG[] * Parameters: char MSG[]
* DEFINED IN: glacier_log.h * DEFINED IN: log.h
* *
*/ */
@ -109,12 +128,13 @@ warnlog(char MSG[])
return; return;
} }
continue;
/* /*
* errlog * errlog
* *
* DESCRIPTION: Output a stylized error message. * DESCRIPTION: Output a stylized error message.
* PARAMETERS: char MSG[] * PARAMETERS: char MSG[]
* DEFINED IN: glacier_log.h * DEFINED IN: log.h
* *
*/ */
@ -134,7 +154,7 @@ errlog(char MSG[])
* *
* DESCRIPTION: Output a stylized success message. * DESCRIPTION: Output a stylized success message.
* PARAMETERS: char MSG[] * PARAMETERS: char MSG[]
* DEFINED IN: glacier_log.h * DEFINED IN: log.h
* *
*/ */
@ -154,7 +174,7 @@ successlog(char MSG[])
* *
* DESCRIPTION: Check if necesary runtime files exist. * DESCRIPTION: Check if necesary runtime files exist.
* PARAMETERS: None. * PARAMETERS: None.
* DEFINED IN: glacier_runtime.h * DEFINED IN: runtime.h
* *
*/ */
@ -182,7 +202,7 @@ runtime_exists(void)
* *
* DESCRIPTION: Check if process is running as root. * DESCRIPTION: Check if process is running as root.
* PARAMETERS: char MSG[] * PARAMETERS: char MSG[]
* DEFINED IN: glacier_runtime.h * DEFINED IN: runtime.h
* *
*/ */
@ -202,7 +222,7 @@ is_process_root(void)
* *
* DESCRIPTION: Initialize libconfig. * DESCRIPTION: Initialize libconfig.
* PARAMETERS: None. * PARAMETERS: None.
* DEFINED IN: glacier_config.h * DEFINED IN: config.h
* *
*/ */
@ -230,7 +250,7 @@ init_config(void)
* *
* DESCRIPTION: Kill libconfig. * DESCRIPTION: Kill libconfig.
* PARAMETERS: None. * PARAMETERS: None.
* DEFINED IN: glacier_config.h * DEFINED IN: config.h
* *
*/ */
@ -251,49 +271,46 @@ die_config(void)
* *
* DESCRIPTION: Loads all settings from the Glacier config file. * DESCRIPTION: Loads all settings from the Glacier config file.
* PARAMETERS: None. * PARAMETERS: None.
* DEFINED IN: glacier_config.h * DEFINED IN: config.h
* *
*/ */
int int
load_all_from_config(void) load_all_from_config(void)
{ {
config_lookup_bool(&cfg, "GLACIER_DO_INT_CHECK", &GLACIER_DO_INT_CHECK); /* this is probably really ugly but it works */
config_lookup_bool(&cfg, "GLACIER_VERBOSE", &GLACIER_VERBOSE); if (! config_lookup_bool(&cfg, "GLACIER_DO_INT_CHECK", &GLACIER_DO_INT_CHECK)) { return 1; }
if (! config_lookup_bool(&cfg, "GLACIER_VERBOSE", &GLACIER_VERBOSE)) { return 1; }
config_lookup_string(&cfg, "GLACIER_REPO", &GLACIER_REPO); return 0;
config_lookup_string(&cfg, "GLACIER_ARCH", &GLACIER_ARCH);
config_lookup_string(&cfg, "GLACIER_TARGET", &GLACIER_TARGET);
config_lookup_string(&cfg, "GLACIER_SYSTEM_PROFILE", &GLACIER_SYSTEM_PROFILE);
} }
/* issues with this idk /*
int * load_all_from_profile
load_all_from_config() *
{ * DESCRIPTION: Loads all settings from the Glacier system profile.
if(config_lookup_bool(&cfg, "GLACIER_ALLOW_SERVICES", &GLACIER_ALLOW_SERVICES)) * PARAMETERS: None.
printf("Services allowed: %s\n", GLACIER_ALLOW_SERVICES ? "true" : "false"); * DEFINED IN: config.h
else *
warnlog("GLACIER_SERVICES_ALLOWED is not defined in glacier.cfg.");
if(config_lookup_bool(&cfg, "GLACIER_DO_INT_CHECK", &GLACIER_DO_INT_CHECK))
printf("Integrity checking enabled: %s\n", GLACIER_DO_INT_CHECK ? "true" : "false");
else
warnlog("GLACIER_DO_INT_CHECK is not defined in glacier.cfg.");
if(config_lookup_bool(&cfg, "GLACIER_VERBOSE", &GLACIER_VERBOSE))
printf("Verbose logging: %s\n", GLACIER_VERBOSE ? "true" : "false");
else
warnlog("GLACIER_VERBOSE is not defined in glacier.cfg.");
}
*/ */
int
load_all_from_profile(void)
{
if (! config_lookup_string(&cfg, "GLACIER_REPO", &GLACIER_REPO)) { return 1; }
if (! config_lookup_string(&cfg, "GLACIER_ARCH", &GLACIER_ARCH)) { return 1; }
if (! config_lookup_string(&cfg, "GLACIER_TARGET", &GLACIER_TARGET)) { return 1; }
if (! config_lookup_string(&cfg, "GLACIER_SYSTEM_PROFILE", &GLACIER_SYSTEM_PROFILE)) { return 1; }
return 0;
}
/* /*
* load_setting_from_config * load_setting_from_config
* *
* DESCRIPTION: Load a specified setting from the Glacier config file. * DESCRIPTION: Load a specified setting from the Glacier config file.
* PARAMETERS: char SETTING[] * PARAMETERS: char SETTING[]
* DEFINED IN: glacier_config.h * DEFINED IN: config.h
* *
*/ */
@ -306,7 +323,7 @@ load_setting_from_config(char SETTING[])
* *
* DESCRIPTION: Create a dependency tree node. * DESCRIPTION: Create a dependency tree node.
* PARAMETERS: char *data * PARAMETERS: char *data
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -324,7 +341,7 @@ struct node
* *
* DESCRIPTION: Add a child node to a parent node. * DESCRIPTION: Add a child node to a parent node.
* PARAMETERS: struct node *parent, struct node *child * PARAMETERS: struct node *parent, struct node *child
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -344,7 +361,7 @@ add_child(struct node *parent, struct node *child)
* *
* DESCRIPTION: Print a dependency tree. * DESCRIPTION: Print a dependency tree.
* PARAMETERS: struct node *root, int level * PARAMETERS: struct node *root, int level
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -366,7 +383,14 @@ print_tree(struct node *root, int level)
} }
} }
/* Definition of queue data type */ /*
* queue
*
* DESCRIPTION: Definition of queue type.
* DEFINED IN: data.h
*
*/
typedef struct { typedef struct {
int items[MAX_SIZE]; int items[MAX_SIZE];
int front; int front;
@ -378,7 +402,7 @@ typedef struct {
* *
* DESCRIPTION: Initialize a queue. * DESCRIPTION: Initialize a queue.
* PARAMETERS: queue *q * PARAMETERS: queue *q
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -394,7 +418,7 @@ init_queue(queue *q)
* *
* DESCRIPTION: Check if queue is empty. * DESCRIPTION: Check if queue is empty.
* PARAMETERS: struct node *root, int level * PARAMETERS: struct node *root, int level
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -405,7 +429,7 @@ bool queue_is_empty(queue *q) { return (q -> front == q -> rear -1); }
* *
* DESCRIPTION: Check if queue is full. * DESCRIPTION: Check if queue is full.
* PARAMETERS: queue *q * PARAMETERS: queue *q
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -416,7 +440,7 @@ bool queue_is_full(queue *q) { return (q -> rear == MAX_SIZE); }
* *
* DESCRIPTION: Enqueue an element at the back of the queue. * DESCRIPTION: Enqueue an element at the back of the queue.
* PARAMETERS: queue *q, int value * PARAMETERS: queue *q, int value
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -437,7 +461,7 @@ enqueue (queue *q, int value)
* *
* DESCRIPTION: Dequeue the element at the front of the queue. * DESCRIPTION: Dequeue the element at the front of the queue.
* PARAMETERS: queue *q, int value * PARAMETERS: queue *q, int value
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -457,7 +481,7 @@ dequeue(queue *q)
* *
* DESCRIPTION: View the element at the front of the queue. * DESCRIPTION: View the element at the front of the queue.
* PARAMETERS: struct node *root, int level * PARAMETERS: struct node *root, int level
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -477,7 +501,7 @@ peek(queue *q)
* *
* DESCRIPTION: Print the queue. * DESCRIPTION: Print the queue.
* PARAMETERS: queue *q * PARAMETERS: queue *q
* DEFINED IN: glacier_data.h * DEFINED IN: data.h
* *
*/ */
@ -502,7 +526,7 @@ print_queue(queue *q)
* *
* DESCRIPTION: Creates a new Glacier workspace in /tmp. * DESCRIPTION: Creates a new Glacier workspace in /tmp.
* PARAMETERS: None. * PARAMETERS: None.
* DEFINED IN: glacier_pkgops.h * DEFINED IN: pkgops.h
* *
*/ */
@ -531,11 +555,10 @@ mkworkspace(void)
* *
* DESCRIPTION: Copies a package archive from the localdb to the workspace, and unpacks it. * DESCRIPTION: Copies a package archive from the localdb to the workspace, and unpacks it.
* PARAMETERS: char PACKAGE[] * PARAMETERS: char PACKAGE[]
* DEFINED IN: glacier_pkgops.h * DEFINED IN: pkgops.h
* *
*/ */
int int
prepare_pkg(char PACKAGE[]) prepare_pkg(char PACKAGE[])
{ {
@ -587,35 +610,12 @@ prepare_pkg(char PACKAGE[])
} }
} }
/* download_package_sources() is deprecated and will be removed in a later release. */
/* int
download_package_sources(char PACKAGE[])
{
printf(COL_BLUE "[i] " COL_RESET "Downloading package archive for %s...\n", PACKAGE);
if (GLACIER_SYSTEM_PROFILE == "x86-musl") {
execl("/glacier/tools/wget", "https://git.everestlinux.org/EverestLinux/epkgs-x86-musl/", NULL);
} else {
printf(COL_RED "[x] " COL_RESET "System profile '%s' is not supported.\n", GLACIER_SYSTEM_PROFILE);
}
} */
void
TEST_chdir(char dir[])
{
char *buf;
chdir(dir);
buf = (char *) malloc(100*sizeof(char));
getcwd(buf, 100);
printf("%s\n", buf);
}
/* /*
* run_make_task * run_make_task
* *
* DESCRIPTION: Runs a make task in current working directory * DESCRIPTION: Runs a make task in current working directory
* PARAMETERS: char TASK[] * PARAMETERS: char TASK[]
* DEFINED IN: glacier_pkgops.h * DEFINED IN: pkgops.h
* *
*/ */
@ -643,10 +643,11 @@ run_make_task(char TASK[])
* *
* DESCRIPTION: Compare two file hashes * DESCRIPTION: Compare two file hashes
* PARAMETERS: char ORIG_HASH[], char FILE[] * PARAMETERS: char ORIG_HASH[], char FILE[]
* DEFINED IN: glacier_security.h * DEFINED IN: security.h
* *
*/ */
/*
int int
compare_file_hash(char ORIG_HASH[], char FILE[]) compare_file_hash(char ORIG_HASH[], char FILE[])
{ {
@ -677,3 +678,4 @@ compare_file_hash(char ORIG_HASH[], char FILE[])
printf("%02x", hash[i]); printf("%02x", hash[i]);
} }
} }
*/

View File

@ -1,27 +0,0 @@
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
int
run_make_task(char task[])
{
char *build_args[] = {
"/bin/make",
task,
NULL
};
execvp(
"/bin/make",
build_args
);
if (errno != 0 ) {
return errno;
}
}
int
main()
{
run_make_task("help");
}