Cli for Armbian Linux Image COnfiguration
1.4.9
Calico is a CLI for Armbian Linux Image Configuration. It is a wrapper around the Armbian build system making preconfiguration of images easier.
Where possible the script will use sensible defaults to configure the image. If there are not enough defaults, or the manual option is used for compile, the armbian build system menu interface will be launched.
The script can be used to modify existing images as well as create new images.
CC BY-SA: https://creativecommons.org/licenses/by-sa/4.0/
Fund me here: https://ko-fi.com/richardatlateralblast
The goals of this script are to:
Provide a command line processor that:
- Can automate the configuration of network and other settings in Armbian images.
- Can build Armbian images.
- Can modify existing Armbian images.
I was unable to get consistent results using the method of setting evironment variables in /root/.not_logged_in_yet, as such the script uses the /root/provisioning.sh method. This allows for more consistent results, and more control over the configuration process.
Current provisioning script features include:
- Create user account
- Set user password
- Set root password
- Set user group
- Set user group ID
- Set user shell
- Create user home directory
- Install user SSH keys
- Set hostname
- Set timezone
- Set locale
- Set real name
- Set netmask
- Set gateway
- Set DNS
- Set locale
The script works on both Linux and MacOS. On Linux it uses the native tools to mount and modify the image. On MacOS it uses Docker to mount and modify the image.
The script will clone the git repository for the Armbian build system if it is not already cloned.
The general process for building an image is:
- Compile the image
- Mount the image
- Modify the image
- Unmount the image
- Write the image
- Test the image
The script will do some sanity checks:
- Check if the write device is a USB device
- Armbian build system
- Docker
- qemu-system-arm
- qemu-system-riscv
- binfmt-support
- qemu-user-binfmt
- ipcalc
Help:
./calico.sh --helpOptions:
./calico.sh --usage optionsVersion:
./calico.sh --versionList boards:
./calico.sh --list boardsList images:
./calico.sh --list imagesList images with full path:
./calico.sh --list images --fullManual compile:
./calico.sh --complile --manualConfigure compile for orangepipc board:
./calico.sh --compile --board orangepipcModify existing image's IP, gateway, DNS, etc:
./calico.sh --modify --image /path/to/image.img --ip 192.168.1.100 --gateway 192.168.1.1 --dns 8.8.8.8 --netmask 255.255.255.0Write image:
./calico.sh --write --image /path/to/image.img --device /dev/sdbMount image:
./calico.sh --mount --image /path/to/image.imgUnmount image:
./calico.sh --unmount --image /path/to/image.imgGenerate runtime configuration:
./calico.sh --generate --type runtimeGenerate buildtime configuration:
./calico.sh --generate --type buildtimeGenerate docker script:
./calico.sh --generate --type dockerAn example of manually mounting an image on Linux:
sudo losetup -P /dev/lopp0 -f /path/to/image.img
sudo mount /dev/loop0p1 /mntAn example of manually mounting an image on MacOS:
docker run --privileged -v /path/to/image:/mnt/image -it ubuntu:latest bash
mkdir /mnt/imagefs
export IMAGE=/path/to/image.img
export LOOPDEV=$(losetup --partscan --find --show "$IMAGE")
lsblk --raw --output "NAME,MAJ:MIN" --noheadings $LOOPDEV | tail -n +2 | while read dev node;
do
MAJ=$(echo $node | cut -d: -f1)
MIN=$(echo $node | cut -d: -f2)
[ ! -e "/dev/$dev" ] && mknod "/dev/$dev" b $MAJ $MIN
done
mount ${LOOPDEV}p1 /mnt/imagefs