/afw

🧰 afw - Arch Framework which helps to install the new Arch Linux

Primary LanguageShellMIT LicenseMIT

afw

Arch Framework which helps to install the new Arch Linux ⚙️

Arch Linux GitHub forks GitHub issues GitHub license GitHub pull requests GitHub stars

All Contributors

Codecov Super-Linter Status

Discord IRC

Buy Me A Pizza

ATTENTION ME!

This is very early stage project. So it may happen some breaking changes.


asciicast

Overview

It's Arch Framework which helps to install the new Arch Linux. afw is made with Bash and available in interactive shell and script.

Good Points

  • Simple structure
  • Easy installation of Arch Linux
  • Highly customizable
  • Custom entry point support

We can add the desktop environment (GNOME, KDE, etc), the server application (OpenSSH, VNC, etc), and the special configuration (Kiosk system, etc) to installation process with a few commands. Configuration is managable as a component. So we can use the components which you need, when you need them!

Philosophy

Be Simple

Done is Better Than Perfect

They continue to maintain good points. They are also useful for helping developers.

User Guides

Work with Interactive Shell

You can try the next commands in Bash to install the new system with the preset named basic:

eval "$(curl https://raw.githubusercontent.com/sakkke/afw/main/lib/afw)"
afw presets/basic

You can see available presets in /components/presets/. Or, you can see how to create the your custom preset.

Work with Script

Add the next one-liner to your script:

eval "$(curl https://raw.githubusercontent.com/sakkke/afw/main/lib/afw)"
The next code is the example script
#!/bin/bash

eval "$(curl https://raw.githubusercontent.com/sakkke/afw/main/lib/afw)"

# Device header lines
AFW_DEVICE_HEADER_LINES=(
  'label: gpt'
)

# Path to EFI file
AFW_EFI_FILE=/GRUB/grubx64.efi

# File systems
AFW_FILESYSTEMS=(
  fat32
  ext4
)

# Bootloader ID for GRUB
AFW_GRUB_BOOTLOADER_ID=GRUB

# Hostname
AFW_HOSTNAME=afw

# /etc/locale.gen
AFW_LOCALE_GEN=(
  'en_US.UTF-8 UTF-8'
)

# Mountpoints
AFW_MOUNTPOINTS=(
  2:/
  1:/boot
)

# Pacman mirrors
AFW_PACMAN_MIRRORS=(
  'https://geo.mirror.pkgbuild.com/$repo/os/$arch'
)

# Packages for the new system
AFW_PACSTRAP_PACKAGES=(
  base
  efibootmgr
  linux
  linux-firmware
  networkmanager
  grub
)

# Partitions
AFW_PARTS=(
  '1 : size=300MiB, type="EFI System"'
  '2 : type="Linux root (x86-64)"'
)

# Passwords
AFW_PASSWORDS=(
  root:afw
)

# Entrypoint for mount
AFW_ROOT=/mnt

# systemd services
AFW_SYSTEMD_SERVICES=(
  NetworkManager.service
)

# Timezone
AFW_TIMEZONE=UTC

# Users
AFW_USERS=()

# User shells
AFW_USER_SHELLS=()

# /etc/vconsole.conf
AFW_VCONSOLE_CONF=(
  KEYMAP=us
)

# Prompt for device which will be installed on the new system
if [[ -z $AFW_DEVICE ]]; then
  read -p AFW_DEVICE= AFW_DEVICE
fi

afw update-ntp
afw part
afw format
afw mount
afw pacman/update-mirrorlist
afw pacstrap
afw update-fstab
afw update-timezone
afw update-adjtime
afw update-locale_gen
afw update-locale
afw update-vconsole_conf
afw update-hostname
afw update-passwords
afw grub/install
afw grub/install-grub_cfg
afw grub/fix-bootx64_efi
afw systemd/enable-services
afw umount

Environment Variables

There are environment variables which is used by afw function.

Name Description Default value
AFW_ENTRYPOINT URL or file path to reference the components directory. https://raw.githubusercontent.com/sakkke/afw/main/components

Development Guides

afw is Bash function; it does two steps:

  1. Download the script from the entry point URL with cURL
  2. Eval the downloaded script content in the current shell

The default entry point URL is https://raw.githubusercontent.com/sakkke/afw/main/components. You can change the entry point URL with the environment variable AFW_ENTRYPOINT.

Directory Structure

  • components/: Entry point
    • deps/: Including scripts of dependencies
      • presets/: Dependencies for presets
      • [-A-Z_a-z]+/: Including scripts
      • [-A-Z_a-z]+: Scripts
    • presets/: Including scripts for users
    • prompts/: Including scripts for inputting
    • vars/: Including scripts of variables
      • presets/: Variables for presets
      • [-A-Z_a-z]+/: Including scripts
      • [-A-Z_a-z]+: Scripts
    • [-A-Z_a-z]+/: Including scripts
    • [-A-Z_a-z]+: Scripts

Script Naming Rules

Scripts are named <noun>, <command_name> or <verb>-<noun>.

Create the your custom preset

A Recommended Way

First, create the script in $AFW_ENTRYPOINT/presets/. Here, name the script as foo. Put the next content to newly created script:

#!/bin/bash

afw vars/foo
afw deps/foo
afw done

#!/bin/bash tells the editor the file type. This script does three steps:

  1. Load variables
  2. Load dependencies
  3. Show the done messages

Second, enter Bash. To run newly created script:

afw presets/foo

Code of Conduct

CODE_OF_CONDUCT.md

Contributing

Feel free to contribute to this project!

CONTRIBUTING.md

License

MIT

LICENSE

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Konosuke Sakai

💻 📖 🤔

Taylor Jean

📖

This project follows the all-contributors specification. Contributions of any kind welcome!