Experimental UBI image-making distro-builder

This commit is contained in:
Mike Staszel 2010-06-17 06:14:19 -07:00
parent f3dd6be0d6
commit 95c9d34012

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# Plugbox Linux Distribution Image Builder # Plugbox Linux Distribution Image Builder
# Version 0.1.2 # Version 0.1.3
# #
# Licensed under the GPLv2. # Licensed under the GPLv2.
# #
@ -13,6 +13,8 @@
# ==== Variables to set ==== # ==== Variables to set ====
INSTALLEDPKGS="base kernel26-withlinux openssh openssl heimdal" INSTALLEDPKGS="base kernel26-withlinux openssh openssl heimdal"
RELEASEVER=1.1 RELEASEVER=1.1
MAKETARGZ=0
MAKEUBIIMG=1
# ==== The Process ==== # ==== The Process ====
mkdir -p $1 mkdir -p $1
echo -e "\033[1mInstalling packages...\033[0m" echo -e "\033[1mInstalling packages...\033[0m"
@ -30,10 +32,35 @@ echo "en_US.UTF-8 UTF-8" >> $1/etc/locale.gen
echo "en_US ISO-8859-1" >> $1/etc/locale.gen echo "en_US ISO-8859-1" >> $1/etc/locale.gen
chroot $1/ /usr/sbin/locale-gen chroot $1/ /usr/sbin/locale-gen
chroot $1/ /usr/bin/pacman -Scc chroot $1/ /usr/bin/pacman -Scc
echo $RELEASEVER > $1/etc/plugbox-version
echo -e "\033[1mCreating a rootfs.tar.gz...\033[0m" # Here is the rootfs.tar.gz part if you set MAKETARGZ to 1
cd $1 if [ $MAKETARGZ = 1 ]; then
echo $RELEASEVER > /etc/plugbox-version echo -e "\033[1mCreating a rootfs.tar.gz...\033[0m"
tar czf ../Plugbox-Linux-$RELEASEVER.tar.gz ./* cd $1
cd ../ tar czf ../Plugbox-Linux-$RELEASEVER.tar.gz ./*
echo -e "\033[1mAll done!\033[0m" cd ../
else
echo -e "\033[1mNot creating a rootfs.tar.gz...\033[0m"
fi
# Here is the UBI image part if you set MAKEUBIIMG to 1
if [ $MAKEUBIIMG = 1 ]; then
echo -e "\033[1mCreating a rootfs.ubi.img...\033[0m"
cat << EOF > ./ubi.cfg
[ubifs]
mode=ubi
image=rootfs.ubifs.img
vol_id=0
vol_size=356MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
EOF
mkfs.ubifs -x zlib -m 2048 -e 129024 -c 4096 -r $1 rootfs.ubifs.img
ubinize -o rootfs.ubi.img -m 2048 -p 128KiB -s 512 ./ubi.cfg
rm -f ubi.cfg rootfs.ubifs.img
echo -e "\033[1mAll done!\033[0m"
else
echo -e "\033[1mAll done!\033[0m"
fi