# Everest Linux - Docs

Home About Install Packages Downloads Docs Errata Git ↗

## Introduction

Glacier is the package management system for Glacier. All users should be familiar with how it works.

## Terminology

In this case, the word 'merge' and 'install' mean the same thing.

A package index is a list of all installed packages on any given Everest system.

The local index is managed by all users on the system, and is located in /usr/glacier/index.

The global index is managed by Git, and is located in /glacier/index.

A system profile describes your base system, including C library, architecture, SELinux support, multilib support, etc.

## Included programs

3.1 gpkg

'gpkg' is the program most users will be interacting with. It handles the downloading, installation, and logging of packages.

3.2 syspkg

'syspkg' is like 'gpkg', except it operates on the system index, rather than the local index. End users should not use this unless instructed to.

3.3 glist

'glist' lists all installed packages, allowing the user to filter by name.

3.4 gquery

'gquery' queries information on a package.

3.5 glacier-mkprofile

'glacier-mkprofile' makes changes to the system-wide profile. Users should not interact with this unless needed.

## Frontends

Frontends, or wrappers, may provide additional functionality to Glacier.

<warnhead>WARNING:</warnhead>

Third party frontends and wrapper scripts are not supported. Use them at your own risk.

## Merging packages

4.1 Using gpkg

To merge a package from a repository:

`(root)# gpkg -f repo/pkg`

For instance, to install 'vim' in the 'world' repository:

`(root)# gpkg -f world/vim`

4.2 Using syspkg

Using 'syspkg' is not recommended for end users because all changes to the global package index will be overwritten when pulling a new update.

If you understand these risks, and wish to use 'syspkg' anyways, you are acknowledging that things may break.

To merge a package from a repository:

`(root)# syspkg -f repo/pkg`

## Updating packages

5.1 Introduction

When merging a package into any index, the package file is retained in said index. This provides most information needed to keep track of the package, however, when updating, an updated package file will need to be downloaded. Old package files will be retained as 'pkgname.old'.

5.2 Using gpkg

To update a package:

`(root)# gpkg -u repo/pkg`

5.3 Using syspkg

As mentioned above, 'syspkg' is intended for system development, and NOT for end users.

However, 'syspkg -u' has some use cases for end users. These include:

- Updating a system program WITHOUT pulling a new release from Git
- Fixing urgent security vulnerabilities

To update a package:

`(root)# syspkg -u repo/pkg`

## Removing packages

6.1 Introduction

When removing a package, the package info file is moved from the appropriate index to /tmp, and saved as 'pkgname.rm'. This means it will be wiped after the next reboot.

6.2 Using gpkg

To remove a package:

`(root)# gpkg -x pkg`

Note that no repository name was provided. It is not required, as no files will be downloaded during the removal process.

If a package is a dependency for another, you will be shown the following error:

`[x] Could not remove (package_name): is a dependency for (package_name)`

6.3 Using syspkg

<warnhead>WARNING:</warnhead>

Removing packages that shipped with the system images WILL cause catastrophic damage. You have been warned.

If you wish to proceed anyways, you can remove a package with:

`(root)# syspkg -x pkg`

## Advanced usage

7.1 Patching packages

Patching packages is the act of editing a package file to change compile options, optimizations, etc. It is very useful if used correctly.

The officially tested and verified method for patching is as follows:

- Download the package file with 'gpkg -d'
- Edit the package file with a text editor of your choice
- Install the locally modified package with 'gpkg -fl pkg'

7.2 Custom package repository

If Glacier's standard package repository is not sufficient, you can use a custom one.

<warnhead>WARNING:</warnhead>

Ensure the repository you wish to migrate to supports your system profile. For example, if your profile is 'x86-musl', the new repository should offer packages compatible with 'x86-musl'.

Errors will occur if this is not taken into account.

To use a custom repository once, to merge a package:

`(root)# GREPO=http://some-repo.org gpkg -f repo/pkg`

To make the changes persistent, change the 'GREPO' variable in '/etc/glacier.conf':

<fhead>FILE: /etc/glacier.conf</fhead>

export GREPO="https://some-repo.org

7.3 Compile flags

When an operation is performed on a package, 'gpkg' invokes the system's C compiler, which can take flags for compilation.

'MAKEFLAGS', 'CFLAGS', 'CXXFLAGS', and 'LDFLAGS' can be set in '/etc/make.conf'.

It is highly recommended to keep '-static' in 'CFLAGS' and 'LDFLAGS'.

7.4 Using syspkg

'syspkg' is intended for development use and not for end users. That being said, 'syspkg' can be used for fixing security vulnerabilities without pulling in a new release from git.

Note that all changes to the global package index ('/glacier/index') will be overwritten during an update, where the user invokes 'git pull' on '/'.

7.5 Whitelisting licenses

Certain license types can be whitelisted or blacklisted. This is useful for controlling which software is installed on your system.

This setting is stored in /etc/glacier.conf, in a simple Bash array. By default, it should look something like this:

<fhead>FILE: /etc/glacier.conf</fhead>

export GLACIER_ALLOWED_LICENSES=("GPL v3" "GPL v2" "GPL" "MIT" "BSD" "APACHE")

7.6 Services

Glacier services are small programs that can do certain tasks within Glacier, such as updating the local package database.

Services must be enabled in /etc/glacier.conf before they can be used.

<fhead>FILE: /etc/glacier.conf</fhead>

export GLACIER_ALLOW_SERVICES="true"

<warnhead>WARNING:</warnhead>

Services can present a security risk to your system if not used properly. Ensure you review each service, its functions, and only use services made by users you trust.

Services can be configured to run at three different times: run (when an operation is started), pkg (when a package is installed), and end (when all pending operations have finished).

Create 3 files in /etc/glacier:

`(root)# touch /etc/glacier/{call-srv,pkg-srv,end-srv}`

There should be a directory in /etc/glacier containing service files. If not, create it now:

`(root)# mkdir /etc/glacier/services`

Now you can add services to the previously created files. For instance:

<fhead>FILE: /etc/glacier/end-srv</fhead>

#!/bin/bash

GLACIER_SRV_DIR="/etc/glacier/services"

$GLACIER_SRV_DIR/update-pkgdb.hook

## Querying packages

8.1 Introduction

Glacier packages, in ther simplest form, are text files, containing instructions on how the package is built, who made it, what it's called, and what files it includes.

8.2 Querying files

All files belonging to a package can be listed with:

`(user)$ gquery -f pkg`

8.3 Querying info

Package info can be listed with:

`(user)$ gquery -i pkg`

## Writing packages

9.1 Introduction

As mentioned before, Glacier packages are simply text files. This makes them very easy to write and maintain.

If you have previous experience writing PKGBUILDs for the AUR, writing Glacier packages should feel very similar.

In this page, 'nano' will be used as an example.

9.2 Metadata

Package files start with metadata, which tells Glacier who made the package, what its called, as well as other information.

Double check that all of this information is correct before submitting a package.

<fhead>FILE: $(pwd)/nano</fhead>

PACKAGE_NAME="nano"

PACKAGE_VER="7.2"

PACKAGE_DESC="The GNU nano text editor"

MAINTAINER="liamwaldron@everestlinux.org"

LICENSE="GPL v3"

ARCH="x86"

INCLUDED_FILES=("/usr/bin/nano" "/usr/bin/rnano")

Hopefully, most of these options are self explanatory.

For INCLUDED_FILES, ensure you DON'T include documentation (manpages, etc).

9.3 Integrity information

<fhead>FILE: $(pwd)/nano</fhead>

SHA256SUMS="86f3442768bd2873cec693f83cdf80b4b444ad3cc14760b74361474fc87a4526"

All packages must include their checksums. When merging a package, 'gpkg' will check the provided checksum against the actual checksum of the package, and if they don't match, the operation will be cancelled.

To get the checksum of a package:

`(user)$ sha256sum package`

9.4 Dependency information

<fhead>FILE: $(pwd)/nano</fhead>

DEPENDS=("")

CONFLICTS=("")

Dependency information is extremely important. It allows 'gpkg' to install any dependencies. It also warns the user when a package conflicts with another.

This should be fairly easy to figure out. Most projects will have this listed in their README. If you're the developer, you'll probably already know the dependencies your package requires.

9.5 Source information

<fhead>FILE: $(pwd)/nano</fhead>

PACKAGE_SRC="https://nano-editor.org/dist/v7/nano-7.2.tar.xz

SOURCES=("nano-7.2.tar.xz" "nano-7.2"

PACKAGE_SRC shows Glacier where the sources for the program can be downloaded from.

SOURCES shows Glacier what PACKAGE_SRC downloads.

9.6 Functions

<fhead>FILE: $(pwd)/nano</fhead>

getsource() {}

buildpkg() {}

installpkg() {}

installpkg_system() {}

removepkg() {}

removepkg_system() {}

updatepkg() {}

updatepkg_system() {}

Inside of the brackets, enter the commands that are needed to perform each function.

Anything prefixed with "system" refers to the use of 'syspkg'.