Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hung3a8 committed Jan 20, 2024
1 parent 093b2f1 commit 18f0db5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
55 changes: 51 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
# image-builder
This repo contains script to build a `.iso` file to install customized Ubuntu.
This repo contains script to build a `.iso` file to install customized Ubuntu for ICPC contests.

# Usage
Firstly, make a copy of `config.sh` called `local_config.sh` and change its content. You will want to change the `MIRROR` for faster installation.

Then, run `./build.sh build` as `root`.
## Prerequisites

Install the `.iso` file on required machines, then head to `src/` for more information.
> Note: The builder will require root access and may bind, use, and alternate two folders `/dev/` and `/run/`. If an error occurs during the run and the builder is not able to unmount the folders, it will be necessary to perform a physical hard reboot. Therefore, **it is recommended to run the builder in a virtual machine**.
The builder requires a Linux system with at least 80GB of free storage and 4GB of RAM. The builder is tested on Ubuntu 20.04 LTS and 22.04 LTS.

In case you want to build on a virtual machine, it is recommended to use VirtualBox, with **FIXED SIZE STORAGE** of at least 80GB and **4GB of RAM**.

First, pull the repository and enter the directory:

```bash
git clone https://github.com/VNOI-Admin/image-builder.git
cd image-builder
```

## Configuration

After cloning the repository, you need to configure the builder. There are several files that need to be configured before building the image:

- `config.local.sh`: A local copy of `config.sh` with personal configuration. This contains two important configuration variables:
- `ICPC_URL`: The URL to the ICPC ISO file. The ICPC Global may release new version of the ISO file that may overwrite the old one. Therefore, if errors related to failed download occur, please update this variable.
- `SUPER_PASSWD`: The password for the `root` user and bootloader.
- `src/config.sh`: This a local copy of `src/config.sh` with machine-wide configuration. This contains several important configuration variables:
- `WEBSERVER_PUBLIC_ADDRESS`: The public address of the webserver, commonly for the backup server. This is accessible by the contestants without the need of VPN, therefore should only be used in case of VPN failure.
- `AUTH_ADDRESS`: The public address of the authentication and VPN central server.
- `SUBNET`: The subnet of the service nodes on the VPN network.
- `src/config.local.sh`: This is an optional configuration file of `src/config.local.sh`. By setting the `VERSION` variable, it will store the version of the build to the image. Useful for debugging and tracking the version of the image.

## Building

To build the image for ICPC contests, run the following command:

```bash
sudo ./build.sh icpc_build
```

In case you want to use a specific version of the original ICPC ISO file, you can put the file inside the folder and rename it to `icpc-image.iso`. The builder will automatically use the file instead of downloading from the ICPC Global website.

In case you want to forcefully download the original ICPC ISO file, you can run the following command:

```bash
sudo ./build.sh icpc_build --force
```

In case you want to optimize the build process, you can run the following command:

```bash
sudo ./build.sh icpc_build --github-action
```

This will automatically remove files that are not needed in the final stage of the build process. Should only be used in CI/CD environment or building on systems with limited storage, not for development.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ OPTIND=1 # Reset in case getopts has been used previously in the shell.
help() {
echo "Usage: $0 {icpc_build}"
echo
echo " icpc_build <image_file>: Build the ISO image based on the ICPC image"
echo " icpc_build: Build the ISO image based on the ICPC image"
echo " generate_actions_secret: Generate actions secret from config.local.sh"
echo " clean: Clean up all files generated by this script"
echo " help: Show this help"
Expand Down
6 changes: 0 additions & 6 deletions config.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

export ARCH="amd64" # Architecture
export DISTRO="focal" # (DEPRECATED) Distribution, focal recommended
export VARIANT="minbase" # Variant

export MIRROR="http://vn.archive.ubuntu.com/ubuntu/" # see https://launchpad.net/ubuntu/+archivemirrors

export INS_DIR="./live-build" # Installation directory
export CHROOT=$INS_DIR/chroot
export IMAGE=$INS_DIR/image
Expand Down

0 comments on commit 18f0db5

Please sign in to comment.