glacier-mkimg v0.0.1-rc1
This commit is contained in:
parent
0da359f81b
commit
9381aecd34
127
src/glacier-mkimg/glacier-mkimg
Normal file → Executable file
127
src/glacier-mkimg/glacier-mkimg
Normal file → Executable file
@ -16,7 +16,29 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Glacier. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
info() {
|
||||
printf ">> Building root filesystem image with the following settings:\n"
|
||||
printf "Image build location: /opt/everest\n"
|
||||
printf "Packages to be installed:\n"
|
||||
printf " - musl\n"
|
||||
printf " - lacc\n"
|
||||
printf " - binutils\n"
|
||||
printf " - busybox\n"
|
||||
printf " - make\n"
|
||||
printf " - runit\n"
|
||||
printf " - glacier\n"
|
||||
printf " - gpc\n"
|
||||
printf " - emk\n"
|
||||
}
|
||||
|
||||
init-env() {
|
||||
mkdir -v /opt/everest
|
||||
mkdir -v /opt/everest/{sources,toolchain}
|
||||
cd /opt/everest
|
||||
}
|
||||
|
||||
get_toolchain() {
|
||||
cd /opt/everest/toolchain
|
||||
printf ">> Downloading toolchain sources...\n"
|
||||
git clone https://git.everestlinux.org/EverestLinux/toolchain
|
||||
if [ "$?" != "0" ]; then
|
||||
@ -24,7 +46,7 @@ get_toolchain() {
|
||||
exit 1
|
||||
fi
|
||||
printf ">> Temporarily adding toolchain to PATH...\n"
|
||||
PATH=$PATH:$(pwd)/toolchain/bin
|
||||
PATH=$PATH:/opt/everest/toolchain/bin
|
||||
printf ">> Finished.\n"
|
||||
exit 0
|
||||
}
|
||||
@ -48,6 +70,7 @@ get_skel() {
|
||||
printf ">> ln -sv /usr/lib /lib\n"
|
||||
printf ">> ln -sv /usr/lib64 /lib64\n"
|
||||
printf ">> Removing .git...\n"
|
||||
mv skel targetfs
|
||||
rm -rf skel/.git
|
||||
if [ "$?" != "0" ]; then
|
||||
printf ">> Failed to remove .git.\n"
|
||||
@ -57,6 +80,21 @@ get_skel() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
prepare_for_pkg() {
|
||||
printf ">> Preparing for package installation...\n"
|
||||
mkdir -v /opt/everest/pkg
|
||||
glacier -c busybox-base
|
||||
glacier -c musl-base
|
||||
glacier -c binutils-base
|
||||
glacier -c glacier-base
|
||||
glacier -c runit-base
|
||||
glacier -c tar-base
|
||||
glacier -c make-base
|
||||
glacier -c lacc-base
|
||||
printf ">> Done.\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
install_busybox() {
|
||||
printf ">> Installing busybox...\n"
|
||||
mv $(pwd)/pkg/busybox-base.tar.gz /var/cache/glacier
|
||||
@ -81,6 +119,18 @@ install_musl() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
install_binutils() {
|
||||
printf ">> Installing binutils...\n"
|
||||
mv $(pwd)/pkg/binutils-base.tar.gz /var/cache/glacier
|
||||
glacier -ci binutils-base
|
||||
if [ "$?" != "0" ]; then
|
||||
printf ">> Failed to install binutils-base.\n"
|
||||
exit 1
|
||||
fi
|
||||
printf ">> Finished.\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
install_glacier() {
|
||||
printf ">> Installing Glacier to target...\n"
|
||||
printf ">> Dependency 1: tar-base\n"
|
||||
@ -97,7 +147,7 @@ install_glacier() {
|
||||
printf ">> Failed to install make-base.\n"
|
||||
exit 1
|
||||
fi
|
||||
printf ">> Dependency 3: tcc-base\n"
|
||||
printf ">> Dependency 3: lacc-base\n"
|
||||
mv $(pwd)/pkg/tcc-base.tar.gz /var/cache/glacier
|
||||
glacier -ci tcc-base
|
||||
if [ "$?" != "0" ]; then
|
||||
@ -105,14 +155,24 @@ install_glacier() {
|
||||
exit 1
|
||||
fi
|
||||
printf ">> All dependencies installed, installing Glacier...\n"
|
||||
#
|
||||
#
|
||||
# WRITE THIS SECTION LATER
|
||||
#
|
||||
#
|
||||
git clone https://git.everestlinux.org/EverestLinux/glacier
|
||||
cd glacier/install
|
||||
chmod +x ../src/*
|
||||
./bootstrap-on-target.sh
|
||||
printf ">> Glacier installed.\n"
|
||||
}
|
||||
|
||||
install_runit() {
|
||||
printf ">> Installing runit...\n"
|
||||
mv $(pwd)/pkg/runit-base.tar.gz /var/cache/glacier
|
||||
glacier -ci runit-base
|
||||
if [ "$?" != "0" ]; then
|
||||
printf ">> Failed to install runit-base.\n"
|
||||
exit 1
|
||||
fi
|
||||
printf ">> Finished.\n"
|
||||
}
|
||||
|
||||
warn_about_cache() {
|
||||
printf ">> WARNING: The cache was used for installing packages to the target.\n"
|
||||
printf ">> It is recommended to run the following command to clean the cache:\n"
|
||||
@ -120,4 +180,57 @@ warn_about_cache() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
change_ownership() {
|
||||
printf ">> Ensuring file ownership is correct...\n"
|
||||
chown -Rv root:root /opt/everest/targetfs
|
||||
chgrp -v 13 /opt/everest/targetfs/var/log/lastlog
|
||||
printf ">> Done.\n"
|
||||
}
|
||||
|
||||
create_img() {
|
||||
printf ">> Creating filesystem image...\n"
|
||||
install -dv /opt/everest/build
|
||||
cd /opt/everest/targetfs
|
||||
tar -cvf /opt/everest/build/everestlinux-${EVEREST_RELEASE}-img.tar *
|
||||
zstd /opt/everest/build/everestlinux-${EVEREST_RELEASE}-img.tar
|
||||
rm /opt/everest/build/everestlinux-${EVEREST_RELEASE}-img.tar
|
||||
printf ">> Done.\n"
|
||||
}
|
||||
|
||||
showhelp_big() {
|
||||
printf "glacier-mkimg - easily compile an Everest Linux image\n"
|
||||
printf "usage - glacier-mkimg [-h] [-t] [-s] [-p] [-o] [-i]\n"
|
||||
printf "\n"
|
||||
printf "glacier-mkimg {init} initialize the environment\n"
|
||||
printf "glacier-mkimg {-t} only download toolchain\n"
|
||||
printf "glacier-mkimg {-s} only download filesystem skeleton\n"
|
||||
printf "glacier-mkimg {-p} only install packages to /opt/everest\n"
|
||||
printf "glacier-mkimg {-o} only change ownership of /opt/everest\n"
|
||||
printf "glacier-mkimg {-i} only create image\n"
|
||||
printf "\n"
|
||||
printf "If no option is passed, glacier-mkimg will perform all tasks\n"
|
||||
printf "glacier-mkimg init must be run before anything else is done\n"
|
||||
printf "\n"
|
||||
printf "This program is free software.\n"
|
||||
printf "See the GNU GPL version 3 for details.\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h|--help)
|
||||
showhelp_big
|
||||
;;
|
||||
init)
|
||||
init_env "$@"
|
||||
;;
|
||||
-t)
|
||||
get_toolchain "$@"
|
||||
;;
|
||||
-s)
|
||||
get_skel "$@"
|
||||
;;
|
||||
-p)
|
||||
printf "not implemented\n"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
9
src/glacier-mkimg/img.conf
Normal file
9
src/glacier-mkimg/img.conf
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# img.conf
|
||||
#
|
||||
|
||||
GLACIER_RELEASE="1.0.0"
|
||||
|
||||
#
|
||||
# end img.conf
|
||||
#
|
Loading…
Reference in New Issue
Block a user