|
|
|
|
@ -1,41 +1,6 @@
@@ -1,41 +1,6 @@
|
|
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
release=${1%-netinst.iso} |
|
|
|
|
execution_directory=$(pwd) |
|
|
|
|
release_name=${release}-netinst |
|
|
|
|
newrelease=${release}-custom |
|
|
|
|
myfiles=${HOME}/myfiles |
|
|
|
|
wantedfile=${execution_directory}/wanted.txt |
|
|
|
|
excludedfile=${execution_directory}/excluded.txt |
|
|
|
|
|
|
|
|
|
# global parameters |
|
|
|
|
original_iso=${execution_directory}/${release_name}.iso |
|
|
|
|
newrelease_iso=${execution_directory}/${newrelease}.iso |
|
|
|
|
|
|
|
|
|
cd "${execution_directory}" || exit 1 |
|
|
|
|
|
|
|
|
|
temp_file=/tmp/tmp_iso_directory.txt |
|
|
|
|
if [ -e ${temp_file} ] |
|
|
|
|
then |
|
|
|
|
temp_dir=$(cat ${temp_file}) |
|
|
|
|
else |
|
|
|
|
temp_dir=$(mktemp -d) |
|
|
|
|
echo "${temp_dir}" > ${temp_file} |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ ! -e "${original_iso}" ] |
|
|
|
|
then |
|
|
|
|
echo "image not found : ${original_iso}" |
|
|
|
|
exit 0 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
package_list='xorriso isolinux python3-apt apt-utils python3-requests rsync wget' |
|
|
|
|
# shellcheck disable=SC2086 |
|
|
|
|
if apt-get -s install ${package_list} |grep ^Inst |
|
|
|
|
then |
|
|
|
|
echo "sudo apt install ${package_list} !!!" |
|
|
|
|
exit 0 |
|
|
|
|
fi |
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" |
|
|
|
|
|
|
|
|
|
ask() { |
|
|
|
|
USER_ANSWER="?"; |
|
|
|
|
@ -51,223 +16,287 @@ ask() {
@@ -51,223 +16,287 @@ ask() {
|
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if [ ! -e "${wantedfile}" ] |
|
|
|
|
then |
|
|
|
|
cat > "${wantedfile}" <<EOF |
|
|
|
|
local-apt-repository |
|
|
|
|
rsync |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
check_tools() |
|
|
|
|
{ |
|
|
|
|
package_list='xorriso isolinux python3-apt apt-utils python3-requests rsync wget' |
|
|
|
|
# shellcheck disable=SC2086 |
|
|
|
|
if apt-get -s install ${package_list} |grep ^Inst |
|
|
|
|
then |
|
|
|
|
echo "Some tools are needed :" |
|
|
|
|
echo "apt install ${package_list}" |
|
|
|
|
exit 0 |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if [ ! -e "${excludedfile}" ] |
|
|
|
|
then |
|
|
|
|
cat > "${excludedfile}" <<EOF |
|
|
|
|
gdm3 |
|
|
|
|
chromium |
|
|
|
|
firefox |
|
|
|
|
check_tools |
|
|
|
|
|
|
|
|
|
usage() { |
|
|
|
|
cat <<EOF |
|
|
|
|
|
|
|
|
|
Upgrade an existant official debian iso to last revision. |
|
|
|
|
|
|
|
|
|
options: |
|
|
|
|
-c|--configfile Specify a config file |
|
|
|
|
-h|--help Show this message. |
|
|
|
|
-i|--isofile Isofile to upgrade |
|
|
|
|
-o|--offline Build a offline capable iso |
|
|
|
|
-v Show more output. |
|
|
|
|
|
|
|
|
|
Configfile contents example: |
|
|
|
|
ISOFILE=$HOME/debian-13.0.0-amd64-netinst.iso |
|
|
|
|
PRESEED=$HOME/preseed.cfg |
|
|
|
|
NEWFLAVOR=custom |
|
|
|
|
MYFILES=$HOME/myfiles |
|
|
|
|
WANTED=$HOME/wanted.txt |
|
|
|
|
SUGGESTED=false |
|
|
|
|
POPCON=false |
|
|
|
|
EXTRA_SCRIPT=$HOME/mycustom.sh |
|
|
|
|
OFFLINE=1 |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo "##### extracting iso" |
|
|
|
|
if [ ! -e "${temp_dir}"/md5sum.txt ] |
|
|
|
|
then |
|
|
|
|
echo "extracting iso to ${temp_dir}" |
|
|
|
|
xorriso -osirrox on -indev "${original_iso}" -extract / "${temp_dir}" |
|
|
|
|
chmod -R +w "${temp_dir}" |
|
|
|
|
fi |
|
|
|
|
main() { |
|
|
|
|
|
|
|
|
|
cd "$SCRIPT_DIR" || exit 1 |
|
|
|
|
|
|
|
|
|
echo "##### myfiles generation" |
|
|
|
|
if ask "populating myfiles with download_myfiles.py ?" |
|
|
|
|
then |
|
|
|
|
mkdir -p ~/myfiles |
|
|
|
|
if ! python3 download_myfiles.py --isodir "${temp_dir}" |
|
|
|
|
ISOFILE="" |
|
|
|
|
VERBOSITY=0 |
|
|
|
|
OFFLINE=0 |
|
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do |
|
|
|
|
case $1 in |
|
|
|
|
-c|--configfile) |
|
|
|
|
CONFIGFILE=$2 |
|
|
|
|
[[ -z ${CONFIGFILE} ]] && echo "missing argument $1" && exit 1 |
|
|
|
|
if [ -e "${CONFIGFILE}" ] |
|
|
|
|
then |
|
|
|
|
# shellcheck source=/dev/null |
|
|
|
|
source "${CONFIGFILE}" |
|
|
|
|
else |
|
|
|
|
echo "ERROR: specified configfile not found"* |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
shift |
|
|
|
|
shift |
|
|
|
|
;; |
|
|
|
|
-h|--help) |
|
|
|
|
usage |
|
|
|
|
exit 0 |
|
|
|
|
;; |
|
|
|
|
-i|--isofile) |
|
|
|
|
ISOFILE=$2 |
|
|
|
|
[[ -z ${ISOFILE} ]] && echo "missing argument $1" && exit 1 |
|
|
|
|
shift |
|
|
|
|
shift |
|
|
|
|
;; |
|
|
|
|
-o|--offline) |
|
|
|
|
OFFLINE=1 |
|
|
|
|
shift |
|
|
|
|
;; |
|
|
|
|
-v|--verbose) |
|
|
|
|
VERBOSITY=1 |
|
|
|
|
shift |
|
|
|
|
;; |
|
|
|
|
*) |
|
|
|
|
echo "ERROR: unknown option: $1" |
|
|
|
|
usage |
|
|
|
|
exit 1 |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
# default initialisation of vars |
|
|
|
|
preseed=${PRESEED:-${SCRIPT_DIR}/preseed.cfg} |
|
|
|
|
newflavor=${NEWFLAVOR:-custom} |
|
|
|
|
myfiles=${MYFILES:-${HOME}/myfiles} |
|
|
|
|
wantedfile=${WANTED:-${HOME}/wanted.txt} |
|
|
|
|
excludedfile=${EXCLUDED:-${SCRIPT_DIR}/excluded.txt} |
|
|
|
|
extra_script=${EXTRA_SCRIPT:-${HOME}/mycustom.sh} |
|
|
|
|
|
|
|
|
|
# debian-13.0.0-amd64-netinst.iso |
|
|
|
|
bnfile=$(basename "${ISOFILE}") |
|
|
|
|
distribution=$( echo "${bnfile}" |cut --delimiter='-' --fields=1 ) |
|
|
|
|
majorversion=$( echo "${bnfile}" |cut --delimiter='-' --fields=2 |cut --delimiter='.' --fields=1 ) |
|
|
|
|
minorversion=$( echo "${bnfile}" |cut --delimiter='-' --fields=2 |cut --delimiter='.' --fields=2 ) |
|
|
|
|
incrementalversion=$( echo "${bnfile}" |cut --delimiter='-' --fields=2 |cut --delimiter='.' --fields=3 ) |
|
|
|
|
architecture=$( echo "${bnfile}" |cut --delimiter='-' --fields=3) |
|
|
|
|
# flavor=$( echo "${bnfile}" |cut --delimiter='-' --fields=4 |cut --delimiter='.' --fields=1 ) |
|
|
|
|
# extension=$( echo "${bnfile}" |cut --delimiter='-' --fields=4 |cut --delimiter='.' --fields=2 ) |
|
|
|
|
destination=${distribution}-${majorversion}.${minorversion}.${incrementalversion}-${architecture}-${newflavor}.iso |
|
|
|
|
|
|
|
|
|
if [ ! -e "${ISOFILE}" ] |
|
|
|
|
then |
|
|
|
|
echo "myfiles generation failure !!!" |
|
|
|
|
echo "image not found : ${ISOFILE}" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
echo "##### myfiles generation" |
|
|
|
|
if ask "populating myfiles with custom files ?" |
|
|
|
|
then |
|
|
|
|
mkdir -p ~/myfiles/zips |
|
|
|
|
if [ ! -e ~/myfiles/zips/gnirehtet-java-v2.5.1.zip ] |
|
|
|
|
if [ ! -e "${wantedfile}" ] |
|
|
|
|
then |
|
|
|
|
cd ~/myfiles/zips/ && wget https://github.com/Genymobile/gnirehtet/releases/download/v2.5.1/gnirehtet-java-v2.5.1.zip |
|
|
|
|
cat > "${wantedfile}" <<EOF |
|
|
|
|
local-apt-repository |
|
|
|
|
rsync |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
if [ ! -e ~/myfiles/zips/dvb-firmware-osmc.zip ] |
|
|
|
|
|
|
|
|
|
if [ ! -e "${excludedfile}" ] |
|
|
|
|
then |
|
|
|
|
cd ~/myfiles/zips/ && wget https://github.com/osmc/dvb-firmware-osmc/archive/refs/heads/master.zip --output-document=dvb-firmware-osmc.zip |
|
|
|
|
cat > "${excludedfile}" <<EOF |
|
|
|
|
gdm3 |
|
|
|
|
chromium |
|
|
|
|
firefox |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
if [ ! -e ~/myfiles/zips/alsa-firmware-1.2.4.tar.bz2 ] |
|
|
|
|
|
|
|
|
|
# create working dir (iso loop in /tmp) |
|
|
|
|
temp_file=/tmp/tmp_iso_directory.txt |
|
|
|
|
if [ -e ${temp_file} ] |
|
|
|
|
then |
|
|
|
|
cd ~/myfiles/zips/ && wget https://www.alsa-project.org/files/files/pub/firmware/alsa-firmware-1.2.4.tar.bz2 |
|
|
|
|
temp_dir=$(cat ${temp_file}) |
|
|
|
|
else |
|
|
|
|
temp_dir=$(mktemp -d) |
|
|
|
|
echo "${temp_dir}" > ${temp_file} |
|
|
|
|
fi |
|
|
|
|
if [ ! -e ~/myfiles/zips/libdvdcss-1.4.3.tar.bz2 ] |
|
|
|
|
|
|
|
|
|
echo "##### extracting iso" |
|
|
|
|
if [ ! -e "${temp_dir}"/md5sum.txt ] |
|
|
|
|
then |
|
|
|
|
cd ~/myfiles/zips/ && wget https://download.videolan.org/pub/libdvdcss/1.4.3/libdvdcss-1.4.3.tar.bz2 |
|
|
|
|
echo "extracting iso to ${temp_dir}" |
|
|
|
|
xorriso -osirrox on -indev "${ISOFILE}" -extract / "${temp_dir}" |
|
|
|
|
chmod -R +w "${temp_dir}" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
#https://gitlab.com/Dark-Sky/rpi-linux-udl/-/blob/master/firmware/dvb-usb-dibusb-6.0.0.8.fw |
|
|
|
|
#https://github.com/osmc/dvb-firmware-osmc/blob/master/dvb-usb-dibusb-6.0.0.8.fw |
|
|
|
|
#https://github.com/osmc/dvb-firmware-osmc/archive/refs/heads/master.zip |
|
|
|
|
|
|
|
|
|
if [ ! -d "${myfiles}" ] |
|
|
|
|
then |
|
|
|
|
mkdir -p "${myfiles}" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
echo "generate preseed.cfg" |
|
|
|
|
cat > /tmp/preseed.cfg <<"EOF" |
|
|
|
|
#_preseed_V1 |
|
|
|
|
### Locale configuration |
|
|
|
|
d-i debian-installer/language string fr |
|
|
|
|
d-i debian-installer/country string FR |
|
|
|
|
d-i debian-installer/locale select fr_FR.UTF-8 |
|
|
|
|
d-i keyboard-configuration/xkb-keymap select fr(latin9) |
|
|
|
|
#d-i keyboard-configuration/toggle select No toggling |
|
|
|
|
d-i keyboard-configuration/layoutcode string fr |
|
|
|
|
d-i keyboard-configuration/modelcode string pc105 |
|
|
|
|
d-i keyboard-configuration/variantcode string latin9 |
|
|
|
|
### Network configuration |
|
|
|
|
d-i netcfg/enable boolean false |
|
|
|
|
### account configuration |
|
|
|
|
#d-i passwd/root-password-crypted password [$6$tYi0kNPyvi45IWqW$vOvUycJFPqZhg.N.g7wNZ96UriyvrxoumTuWpRD0OoRp47iuqGfvICxNrsVE0IRHaTs.KkU/btWqJYdetRlpE1] |
|
|
|
|
#d-i passwd/user-fullname string Cyril CONSTANTIN |
|
|
|
|
#d-i passwd/username string constcyr |
|
|
|
|
#d-i passwd/user-password-crypted password [$6$tYi0kNPyvi45IWqW$vOvUycJFPqZhg.N.g7wNZ96UriyvrxoumTuWpRD0OoRp47iuqGfvICxNrsVE0IRHaTs.KkU/btWqJYdetRlpE1] |
|
|
|
|
#d-i passwd/user-uid string 1000 |
|
|
|
|
#d-i passwd/user-default-groups string audio cdrom video |
|
|
|
|
### Clock and time zone setup |
|
|
|
|
d-i clock-setup/utc boolean true |
|
|
|
|
d-i time/zone string Europe/Paris |
|
|
|
|
# Controls whether to use NTP to set the clock during the install |
|
|
|
|
#d-i clock-setup/ntp boolean true |
|
|
|
|
# NTP server to use. The default is almost always fine here. |
|
|
|
|
#d-i clock-setup/ntp-server string ntp.example.com |
|
|
|
|
### Partitioning |
|
|
|
|
### Base system installation |
|
|
|
|
### Apt setup |
|
|
|
|
d-i apt-setup/use_mirror boolean false |
|
|
|
|
apt-cdrom-setup apt-setup/cdrom/set-next boolean false |
|
|
|
|
### Package selection |
|
|
|
|
popularity-contest popularity-contest/participate boolean false |
|
|
|
|
EOF |
|
|
|
|
echo "### download wanted packages" |
|
|
|
|
if [ -e "${wantedfile}" ] && [ -e "${excludedfile}" ] |
|
|
|
|
then |
|
|
|
|
if python3 download_myfiles.py --isodir "${temp_dir}" \ |
|
|
|
|
--wanted "${wantedfile}" --excluded "${excludedfile}" \ |
|
|
|
|
--files "${myfiles}" --quiet |
|
|
|
|
then |
|
|
|
|
echo "### myfiles generation ok" |
|
|
|
|
else |
|
|
|
|
echo "### myfiles generation failure !!!" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
echo "download_myfiles.py disabled" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
cat > "${myfiles}"/libdvdcss2.README <<"EOF" |
|
|
|
|
libdvd-pkg: Downloading orig source... |
|
|
|
|
I: libdvdcss_1.4.3 |
|
|
|
|
/usr/bin/wget --tries=3 --timeout=40 --read-timeout=40 --continue -O libdvdcss_1.4.3.orig.tar.bz2 \ |
|
|
|
|
https://download.videolan.org/pub/libdvdcss/1.4.3/libdvdcss-1.4.3.tar.bz2 \ |
|
|
|
|
|| /usr/bin/uscan --noconf --verbose --rename --destdir=/usr/src/libdvd-pkg --check-dirname-level=0 --force-download --download-current-version /usr/share/libdvd-pkg/debian |
|
|
|
|
--2026-01-02 21:06:57-- https://download.videolan.org/pub/libdvdcss/1.4.3/libdvdcss-1.4.3.tar.bz2 |
|
|
|
|
Résolution de download.videolan.org (download.videolan.org)… 213.36.253.2, 2a01:e0d:1:3:58bf:fa02:c0de:5 |
|
|
|
|
Connexion à download.videolan.org (download.videolan.org)|213.36.253.2|:443… connecté. |
|
|
|
|
requête HTTP transmise, en attente de la réponse… 200 OK |
|
|
|
|
Taille: 388404 (379K) [application/octet-stream] |
|
|
|
|
Sauvegarde en: «libdvdcss_1.4.3.orig.tar.bz2» |
|
|
|
|
libdvdcss_1.4.3.orig.tar.bz2 100%[==============================================================>] 379,30K 725KB/s ds 0,5s |
|
|
|
|
2026-01-02 21:06:58 (725 KB/s) — «libdvdcss_1.4.3.orig.tar.bz2» sauvegardé [388404/388404] |
|
|
|
|
EOF |
|
|
|
|
echo "### add extra script content" |
|
|
|
|
if [ -e "${extra_script}" ] |
|
|
|
|
then |
|
|
|
|
eval "$(cat "${extra_script}")" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
cat > "${myfiles}"/cs46xx.README <<"EOF" |
|
|
|
|
# not included |
|
|
|
|
apt install alsa-utils |
|
|
|
|
tar xvf alsa-firmware-1.2.4.tar.bz2 |
|
|
|
|
cd alsa-firmware-1.2.4/cs46xx |
|
|
|
|
mkdir /lib/firmware/cs46xx |
|
|
|
|
cp ba1 cwc4630 cwcasync cwcbinhack cwcdma cwcsnoop /lib/firmware/cs46xx |
|
|
|
|
modprobe -r snd-cs46xx |
|
|
|
|
modprobe snd-cs46xx |
|
|
|
|
adduser yourusername audio |
|
|
|
|
alsamixer : demute |
|
|
|
|
aplay /usr/share/sounds/alsa/Noise.wav |
|
|
|
|
speaker-test -t sine -f 440 -c 2 |
|
|
|
|
speaker-test -t wav -c 2 |
|
|
|
|
if [[ ${OFFLINE} -gt 0 ]] |
|
|
|
|
then |
|
|
|
|
if ! grep local-apt-repository "${wantedfile}" |
|
|
|
|
then |
|
|
|
|
echo "ERROR: local-apt-repository is required in wanted file for offline mode" |
|
|
|
|
exit 1 |
|
|
|
|
else |
|
|
|
|
cat > ${myfiles}/local-apt-repository.sh <<"EOEF" |
|
|
|
|
#!/usr/bin/env bash |
|
|
|
|
echo "### Activate apt cdrom" |
|
|
|
|
sed --expression "s/^[#]*deb cdrom:/deb [trusted=yes] cdrom:/" /etc/apt/sources.list |
|
|
|
|
sed --expression="s/^[#]*deb cdrom:/deb [trusted=yes] cdrom:/" --in-place /etc/apt/sources.list |
|
|
|
|
echo "### Prepare for local-apt-repository usage" |
|
|
|
|
local_apt_repository=/srv/local-apt-repository |
|
|
|
|
source_directory=/media/cdrom0 |
|
|
|
|
original_list=/tmp/original_list.txt |
|
|
|
|
cat > ${original_list} <<EOF |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
cat > "${myfiles}"/local-apt-repository.sh <<"EOF" |
|
|
|
|
#!/bin/bash |
|
|
|
|
help() |
|
|
|
|
{ |
|
|
|
|
echo "rsync and local-apt-repository packages are mandatory" |
|
|
|
|
} |
|
|
|
|
if [[ -n $(find "$(pwd)" -name "rsync*deb") ]] |
|
|
|
|
then |
|
|
|
|
find "$(pwd)" -name "rsync*deb" -exec dpkg -i {} \; |
|
|
|
|
else |
|
|
|
|
help |
|
|
|
|
fi |
|
|
|
|
if [[ -n $(find "$(pwd)" -name "local-apt-repository*deb") ]] |
|
|
|
|
then |
|
|
|
|
find "$(pwd)" -name "local-apt-repository*deb" -exec dpkg -i {} \; |
|
|
|
|
else |
|
|
|
|
help |
|
|
|
|
fi |
|
|
|
|
mkdir /srv/local-apt-repository |
|
|
|
|
mkdir /srv/zips |
|
|
|
|
rsync --recursive "$(pwd)"/pool /srv/local-apt-repository/ |
|
|
|
|
rsync --recursive "$(pwd)"/firmware /srv/local-apt-repository/ |
|
|
|
|
rsync --recursive "$(pwd)"/zips/ /srv/zips |
|
|
|
|
mkdir -p "${local_apt_repository}" |
|
|
|
|
find ${source_directory} -name Packages.gz |
|
|
|
|
while IFS= read -r -d '' gzlist |
|
|
|
|
do |
|
|
|
|
echo "### Scan ${gzlist}" |
|
|
|
|
zgrep pool "${gzlist}" | cut --delimiter=' ' --fields=2 >> ${original_list} |
|
|
|
|
done < <(find ${source_directory} -name Packages.gz -print0) |
|
|
|
|
pushd ${source_directory} || return 1 |
|
|
|
|
while IFS= read -r -d '' packagepath |
|
|
|
|
do |
|
|
|
|
if ! grep "^${packagepath}$" ${original_list} |
|
|
|
|
then |
|
|
|
|
echo "### Package $(basename "${packagepath}") not in original cd. Copy in /local-apt-repository." |
|
|
|
|
mkdir --parents --verbose ${local_apt_repository}/"$(dirname "${packagepath}")" |
|
|
|
|
cp --verbose "${packagepath}" ${local_apt_repository}"/$(dirname "${packagepath}")"/"$(basename "${packagepath}")" |
|
|
|
|
fi |
|
|
|
|
done < <(find pool -name "*.deb" -print0) |
|
|
|
|
popd || return 1 |
|
|
|
|
apt --yes install "$(find ${local_apt_repository} -name "local-apt-repository*.deb")" |
|
|
|
|
apt clean |
|
|
|
|
apt update |
|
|
|
|
EOF |
|
|
|
|
apt upgrade |
|
|
|
|
EOEF |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
cat > "${myfiles}"/README.custom <<"EOF" |
|
|
|
|
You can add package under <cdrom> or <disk> with dpkg e.g. |
|
|
|
|
# find /mnt/cdrom0 -name "rsync*.deb" -exec dpkg -i {} \; |
|
|
|
|
But you have to install dependencies one by one as the same method. |
|
|
|
|
=== |
|
|
|
|
In offline mode, |
|
|
|
|
Mount cdrom ( mount /dev/sr0 ) |
|
|
|
|
And execute local-apt-repository.sh |
|
|
|
|
=== |
|
|
|
|
|
|
|
|
|
The most convenient is to execute : |
|
|
|
|
# mount <installation_device> |
|
|
|
|
# cd <installation_device> |
|
|
|
|
# bash local-apt-repository.sh |
|
|
|
|
|
|
|
|
|
It copy all packages into /srv/local-apt-repository and populate apt with all package |
|
|
|
|
Check you have enough space on /srv before (size of the disk/iso). |
|
|
|
|
|
|
|
|
|
Start the systemd service |
|
|
|
|
# systemctl start local-apt-repository.service |
|
|
|
|
Check after one or two minutes with |
|
|
|
|
# apt list |
|
|
|
|
And you can install them |
|
|
|
|
# apt install tmux |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
if ask "customize installer (add preseed and modify installation option) ?" |
|
|
|
|
then |
|
|
|
|
chmod -R +w "${temp_dir}" |
|
|
|
|
cp -v /tmp/preseed.cfg "${temp_dir}"/preseed.cfg |
|
|
|
|
# sed -e "s#quiet#priority=high locale=fr_FR.UTF-8 keymap=fr file=/cdrom/preseed.cfg#" ${temp_dir}/isolinux/txt.cfg |
|
|
|
|
# sed -i -e "s#quiet#priority=high locale=fr_FR.UTF-8 keymap=fr file=/cdrom/preseed.cfg#" ${temp_dir}/isolinux/txt.cfg |
|
|
|
|
sed -e "s#quiet#file=/cdrom/preseed.cfg#" "${temp_dir}"/isolinux/txt.cfg |
|
|
|
|
sed -i -e "s#quiet#file=/cdrom/preseed.cfg#" "${temp_dir}"/isolinux/txt.cfg |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
rsync --dry-run --verbose --recursive "${myfiles}"/ "${temp_dir}" |
|
|
|
|
if ask "copy additionnal packages ?" |
|
|
|
|
then |
|
|
|
|
echo "### customize initrd with preseed" |
|
|
|
|
if [ -e "${preseed}" ] |
|
|
|
|
then |
|
|
|
|
# cpio on "out mode" don't allow to rename/basename file on the fly |
|
|
|
|
# so we need to put the file somewhere with the target name |
|
|
|
|
# and go (pushd) to the directoy considered as root (/) of the initrd |
|
|
|
|
cp --verbose "${preseed}" /tmp/preseed.cfg |
|
|
|
|
pushd /tmp || return 1 |
|
|
|
|
case $(uname -m) in |
|
|
|
|
i686) |
|
|
|
|
echo "### Detected install.386" |
|
|
|
|
gunzip --verbose "${temp_dir}/install.386/initrd.gz" |
|
|
|
|
echo preseed.cfg | cpio --format=newc --create --append --verbose --file="${temp_dir}"/install.386/initrd |
|
|
|
|
gzip --verbose "${temp_dir}"/install.386/initrd |
|
|
|
|
ls -l "${temp_dir}"/install.386/initrd.gz |
|
|
|
|
;; |
|
|
|
|
x86_64) |
|
|
|
|
echo "### Detected install.amd" |
|
|
|
|
gunzip --verbose "${temp_dir}/install.amd/initrd.gz" |
|
|
|
|
echo preseed.cfg | cpio --format=newc --create --append --verbose --file="${temp_dir}"/install.amd/initrd |
|
|
|
|
gzip --verbose "${temp_dir}"/install.amd/initrd |
|
|
|
|
ls -l "${temp_dir}"/install.amd/initrd.gz |
|
|
|
|
;; |
|
|
|
|
*) |
|
|
|
|
echo "Platform not implemented" |
|
|
|
|
exit 1 |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
popd || return 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
echo "### Add content of myfiles" |
|
|
|
|
rsync --verbose --recursive "${myfiles}"/ "${temp_dir}" |
|
|
|
|
# echo "Generate Release file" |
|
|
|
|
# apt-ftparchive \ |
|
|
|
|
# -o "APT::FTPArchive::Release::Origin=local-apt-repository" \ |
|
|
|
|
# -o "APT::FTPArchive::Release::Description=Local APT repository" \ |
|
|
|
|
# release ${custom_dir} > ${custom_dir}/Release |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Final steps |
|
|
|
|
# Calculate md5 and generate iso |
|
|
|
|
echo "### Calculate md5sum.txt" |
|
|
|
|
chmod +w "${temp_dir}"/md5sum.txt |
|
|
|
|
pushd "${temp_dir}" || return 1 |
|
|
|
|
find . -follow -type f ! -name "md5sum.txt" -print0 | xargs -0 md5sum > md5sum.txt |
|
|
|
|
popd || return 1 |
|
|
|
|
chmod -R -w "${temp_dir}" |
|
|
|
|
|
|
|
|
|
echo "calculate md5sum.txt" |
|
|
|
|
chmod +w "${temp_dir}"/md5sum.txt |
|
|
|
|
cd "${temp_dir}" && find . -follow -type f ! -name "md5sum.txt" -print0 | xargs -0 md5sum > md5sum.txt |
|
|
|
|
chmod -R -w "${temp_dir}" |
|
|
|
|
echo "### Create iso" |
|
|
|
|
xorriso -as mkisofs -o "${destination}" \ |
|
|
|
|
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \ |
|
|
|
|
-c isolinux/boot.cat -b isolinux/isolinux.bin \ |
|
|
|
|
-no-emul-boot -boot-load-size 4 \ |
|
|
|
|
-boot-info-table "${temp_dir}" |
|
|
|
|
|
|
|
|
|
cd "${HOME}" || exit 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ask "generate final iso ?" |
|
|
|
|
then |
|
|
|
|
xorriso -as mkisofs -o "${newrelease_iso}" \ |
|
|
|
|
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \ |
|
|
|
|
-c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot \ |
|
|
|
|
-boot-load-size 4 -boot-info-table "${temp_dir}" |
|
|
|
|
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then |
|
|
|
|
main "$@" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
echo "=== End of script ===" |
|
|
|
|
exit 0 |