#!/bin/sh # # This script is licensed under GPL V3 or higher # # EXTRA_REPOS="" check_and_install_nongpl(){ wget -q -O /extra-packages.netinstall http://preseed/extra-packages.netinstall if [ -f "/extra-packages.netinstall" ]; then oIFS=$IFS IFS="|" repos="$(egrep -i 'repository' /extra-packages.netinstall |sed -r 's% +% %g'|cut -d' ' -f2- )" packages="$(egrep -i 'package' /extra-packages.netinstall |sed -r 's% +% %g'|cut -d' ' -f2- )" for r in $repos ; do echo deb $r >> /target/etc/apt/sources.list done; EXTRA_REPOS=$repos if [ "x$packages" != "x" ]; then in-target apt-get update in-target apt-get -y install $packages fi rm /extra-packages.netinstall IFS=$oIFS fi } check_and_run_extra_commands(){ wget -q -O /extra-commands.netinstall http://preseed/extra-commands.netinstall scr="/extra-commands.netinstall" if [ -f "$scr" ]; then oIFS=$IFS IFS="|" sh $scr rm $scr IFS=$oIFS fi } # First fix the sources list for generic lliurex flavours put_apt_conf(){ base="${1}" param="${2}" if [ -z "${param}" ]; then param="desktop" fi if [ -n "${force_server}" ]; then SERVER="${force_server}" else case $param in "client") SERVER="http://mirror/llx19" ;; # NOT AVAILABLE IN NETINSTALL # "server") # SERVER="file:///net/mirror/llxXXXX" # ;; "desktop") SERVER="http://mirror/llx19" ;; ## INFANTIL CASE AND OTHERS *) SERVER="http://mirror/llx19" ;; esac fi echo "# LliureX Net-Installation ${param}" > ${BASE_DIR}/etc/apt/sources.list echo "deb ${SERVER} bionic main universe restricted multiverse" >> ${BASE_DIR}/etc/apt/sources.list echo "deb ${SERVER} bionic-updates main universe restricted multiverse" >> ${BASE_DIR}/etc/apt/sources.list echo "deb ${SERVER} bionic-security main universe restricted multiverse" >> ${BASE_DIR}/etc/apt/sources.list if [ "x$EXTRA_REPOS" != "x" ]; then oIFS=$IFS IFS="|" for r in $EXTRA_REPOS; do echo deb $r >> ${BASE_DIR}/etc/apt/sources.list done IFS=$oIFS fi if [ "$param" = "infantil" ]; then echo "deb ${SERVER} bionic preschool" >> ${BASE_DIR}/etc/apt/sources.list fi } # Initial param checking if [ -z "${1}" ]; then exit 1 else BASE_DIR="$1" fi if [ ! -d "${BASE_DIR}" -o ! -f "${BASE_DIR}/etc/apt/sources.list" ];then exit 1 fi class=$(cat /proc/cmdline |sed -r "s%.*preseed/url=http://preseed/([a-zA-Z_-]+).cfg\.*%\1%i;tx;d;:x") base_class=$(echo $class|cut -d- -f1|tr [A-Z] [a-z]) force_server=$(cat /proc/cmdline |sed -r "s%.*force_server=(http://[0-9a-zA-Z_/.:-]+).*%\1%i;tx;d;:x") check_and_install_nongpl put_apt_conf ${BASE_DIR} ${base_class} # in-target dpkg --add-architecture i386 check_and_run_extra_commands #if [ "x$base_class" = "xinfantil" ]; then # in-target apt-get update # in-target apt-get -y install lliurex-meta-infantil #fi exit 0