PKGBUILDs/scripts/distro-builder

29 lines
866 B
Bash

#!/bin/bash
#
# Plugbox Linux Distribution Image Builder
# Version 0.0.1
#
# Licensed under the GPLv2.
#
# Usage: ./distro-builder working/directory/
#
# NOTE: This script is interactive. Agree to installing packages and answer "y" to cleaning the Pacman database
# ==== Variables to set ====
INSTALLEDPKGS="base kernel26-withlinux openssh openssl"
RELEASEVER=1.1
# ==== The Process ====
mkdir -p $1
echo "Installing packages..."
mkdir -p $1/var/lib/pacman
pacman -Syy -r $1 $INSTALLEDPKGS
echo "Setting the password to 'root' and cleaning up"
echo -e "root\nroot\n" | chroot $1/ /usr/bin/passwd root
chroot $1/ /usr/bin/pacman -Scc
chroot $1/ /usr/bin/pacman -Q > /installed-pkgs.txt
mv $1/installed-pkgs.txt ./
echo "Creating a rootfs.tar.gz..."
cd $1
echo $RELEASEVER > /etc/plugbox-version
tar czf ../Plugbox-Linux-$RELEASEVER.tar.gz ./*
cd ../
echo "All done!"