#!/bin/bash # wxyz main profile build script # # This file is part of wxyz GNU/Linux. # # wxyz GNU/Linux is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # wxyz GNU/Linux is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # wxyz GNU/Linux. If not, see . version="0.1" #success_message="OK! ;-)" success_message="\e[34m[ \e[32mOK\e[34m ]\e[0m" error_message="\e[34m[ \e[31m!!\e[34m ]\e[0m" die() { printf "\n\e[31m-------------------------------------------------------------------------------\e[0m\n\n" printf "die(): %b\n" "$1" printf "Please contact the profile/build script maintainer.\n" printf "\n\e[31m-------------------------------------------------------------------------------\e[0m\n\n" exit 1; } #TODO: Add required packages, such as Linux package_names=( "binutils" "busybox" "e2fsprogs" "eudev") package_versions=( "2.39" "1.33.2" "1.46.5" "3.2.11") package_sources=(\ "https://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.xz" \ "https://www.busybox.net/downloads/busybox-1.33.2.tar.bz2" \ "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.46.5/e2fsprogs-1.46.5.tar.xz" \ "https://github.com/eudev-project/eudev/releases/download/v3.2.11/eudev-3.2.11.tar.gz" \ ) printf "wxyz main profile build script v%s\n\n" "$version" printf "Checking if package_names, package_versions, and package_sources are the same length... " if [ ${#package_names[@]} == ${#package_versions[@]} ] && [ ${#package_versions[@]} == ${#package_sources[@]} ]; then printf "%b\n" "$success_message" else printf "%b\n" "$error_message" die "package_* does not match" fi printf "\nThese packages will be installed to the profile by this script:\n" for (( i=0; i<${#package_names[@]}; i++ )); do printf "%s " "${package_names[$i]}" printf "v%s -" "${package_versions[$i]}" printf " Source: %s \n" "${package_sources[$i]}" done printf "\n" printf "Creating tmp directory... " if [[ -d tmp ]]; then printf "Already exists. %b\n" "$success_message" else if eval mkdir tmp; then printf "%b\n" "$success_message" else printf "%b\n" "$error_message" die "cannot create tmp directory; is the disk read only?" fi fi for (( i=0; i<${#package_names[@]}; i++ )); do printf "Downloading %s " "${package_names[$i]}" printf "v%s... " "${package_versions[$i]}" if eval curl -s --output-dir "tmp" -LO "${package_sources[$i]}"; then printf "%b\n" "$success_message" else printf "%b\n" "$error_message" die "downloading package failed" fi done printf "\n" # TODO: Build packages and install them onto the filesystem