2009-01-03 05:38:53 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Plugbox Linux Distribution Image Builder
|
2010-06-14 03:52:37 +00:00
|
|
|
# Version 0.1.1
|
2009-01-03 05:38:53 +00:00
|
|
|
#
|
|
|
|
# Licensed under the GPLv2.
|
|
|
|
#
|
2010-06-14 03:45:27 +00:00
|
|
|
# Usage: ./distro-builder workingdir
|
|
|
|
#
|
|
|
|
# NOTE: This script is interactive.
|
|
|
|
# Agree to installing packages and answer "y" to cleaning the Pacman database.
|
2009-01-03 05:38:53 +00:00
|
|
|
#
|
|
|
|
# ==== Variables to set ====
|
2010-06-14 03:45:27 +00:00
|
|
|
INSTALLEDPKGS="base kernel26-withlinux openssh openssl heimdal"
|
2009-01-03 05:38:53 +00:00
|
|
|
RELEASEVER=1.1
|
|
|
|
# ==== The Process ====
|
|
|
|
mkdir -p $1
|
2010-06-14 03:45:27 +00:00
|
|
|
echo -e "\033[1mInstalling packages...\033[0m"
|
2009-01-03 05:38:53 +00:00
|
|
|
mkdir -p $1/var/lib/pacman
|
|
|
|
pacman -Syy -r $1 $INSTALLEDPKGS
|
2010-06-14 03:45:27 +00:00
|
|
|
|
|
|
|
echo -e "\033[1mSetting the password to 'root' and cleaning up:\033[0m"
|
2009-01-03 05:38:53 +00:00
|
|
|
echo -e "root\nroot\n" | chroot $1/ /usr/bin/passwd root
|
2010-06-14 03:52:37 +00:00
|
|
|
rm $1/dev/{console,null,zero}
|
|
|
|
chroot $1/ mknod -m 600 /dev/console c 5 1
|
|
|
|
chroot $1/ mknod -m 666 /dev/null c 1 3
|
|
|
|
chroot $1/ mknod -m 666 /dev/zero c 1 5
|
|
|
|
chroot $1/ /usr/sbin/locale-gen
|
2009-01-03 05:38:53 +00:00
|
|
|
chroot $1/ /usr/bin/pacman -Scc
|
2010-06-14 03:45:27 +00:00
|
|
|
|
|
|
|
echo -e "\033[1mCreating a rootfs.tar.gz...\033[0m"
|
2009-01-03 05:38:53 +00:00
|
|
|
cd $1
|
|
|
|
echo $RELEASEVER > /etc/plugbox-version
|
|
|
|
tar czf ../Plugbox-Linux-$RELEASEVER.tar.gz ./*
|
|
|
|
cd ../
|
2010-06-14 03:45:27 +00:00
|
|
|
echo -e "\033[1mAll done!\033[0m"
|