Line 46... |
Line 46... |
46 |
ALCASAR_EXTRACTED_DIR=$(echo $ALCASAR_TARBALL | rev | cut -d '.' -f 3- | rev)
|
46 |
ALCASAR_EXTRACTED_DIR=$(echo $ALCASAR_TARBALL | rev | cut -d '.' -f 3- | rev)
|
47 |
ALCASAR_VERSION=`echo $ALCASAR_EXTRACTED_DIR | cut -d"-" -f2`
|
47 |
ALCASAR_VERSION=`echo $ALCASAR_EXTRACTED_DIR | cut -d"-" -f2`
|
48 |
TMP_DIR=/var/tmp
|
48 |
TMP_DIR=/var/tmp
|
49 |
MAGEIA_NEW_DIR=$TMP_DIR/mageia_new
|
49 |
MAGEIA_NEW_DIR=$TMP_DIR/mageia_new
|
50 |
MAGEIA_OFFICIAL_DIR=$TMP_DIR/mageia_official
|
50 |
MAGEIA_OFFICIAL_DIR=$TMP_DIR/mageia_official
|
51 |
MAGEIA_OFFICIAL_DIR_EFI=$TMP_DIR/mageia_official_efi
|
- |
|
52 |
coreDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/core
|
51 |
coreDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/core
|
53 |
nonFreeDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/nonfree
|
52 |
nonFreeDir=${MAGEIA_OFFICIAL_DIR}/${ARCH}/media/nonfree
|
- |
|
53 |
mediaDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media
|
54 |
coreDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/core/
|
54 |
coreDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/core/
|
55 |
nonFreeDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/nonfree
|
55 |
nonFreeDirNew=${MAGEIA_NEW_DIR}/${ARCH}/media/nonfree
|
- |
|
56 |
urpmi_cache=/var/cache/urpmi/rpms
|
56 |
|
57 |
|
57 |
# Drake installer
|
58 |
# Drake installer
|
58 |
INSTALLER_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/alcasar"
|
59 |
INSTALLER_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/alcasar"
|
59 |
EFI_GRUB_CFG="${MAGEIA_NEW_DIR}/boot/grub2/grub.cfg"
|
60 |
EFI_GRUB_CFG="${MAGEIA_NEW_DIR}/boot/grub2/grub.cfg"
|
60 |
ADVERT_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/extra/advertising"
|
61 |
ADVERT_DIR="${MAGEIA_NEW_DIR}/${ARCH}/install/extra/advertising"
|
61 |
AUTO_INSTALL_CFG=$TMP_DIR/auto_inst.cfg.pl
|
62 |
AUTO_INSTALL_CFG=$TMP_DIR/auto_inst.cfg.pl
|
62 |
|
63 |
|
63 |
# RPMs needed during an install stage
|
64 |
# RPMs needed during an install stage
|
64 |
BASE_RPM_LIST="acpi acpid alsa-utils aoss arp-scan basesystem bash-completion coreutils-doc cpupower curl dhcp-client dmraid dnf dnf-plugins-core dosfstools dracut drakx-net-text gpm grub2 grub2-efi grub2-mageia-theme harddrake hdparm hexedit info ldetect lftp lib64alsa-plugins lib64glib-networking-gnutls locales-en locales-fr lsof lvm2 mageia-theme-Default man-db man-pages microcode microcode_ctl mtools ntfs-3g numlock os-prober p11-kit perl-Hal-Cdroms plymouth procmail python3 python3-dbus radeon-firmware ralink-firmware rtlwifi-firmware sharutils shorewall-ipv6 strace sysfsutils tmpwatch tree vim-minimal vnstat xdg-user-dirs-gtk sudo socat mandi mandi-ifw"
|
65 |
BASE_RPM_LIST="acpi acpid alsa-utils aoss arp-scan basesystem bash-completion coreutils-doc cpupower curl dhcp-client dmraid dnf dnf-plugins-core dosfstools dracut drakx-net-text gpm grub2 grub2-efi grub2-mageia-theme harddrake hdparm hexedit info ldetect lftp lib64alsa-plugins lib64glib-networking-gnutls locales-en locales-fr lsof lvm2 mageia-theme-Default man-db man-pages microcode microcode_ctl mtools ntfs-3g numlock os-prober p11-kit perl-Hal-Cdroms plymouth procmail python3 python3-dbus radeon-firmware ralink-firmware rtlwifi-firmware sharutils shorewall-ipv6 strace sysfsutils tmpwatch tree vim-minimal vnstat xdg-user-dirs-gtk sudo socat mandi mandi-ifw"
|
- |
|
66 |
ISO_RPM_LIST="cdrkit-genisoimage xorriso rpmtools syslinux"
|
65 |
|
67 |
|
66 |
#######################
|
68 |
#######################
|
67 |
###### Main ######
|
69 |
###### Main ######
|
68 |
################################################################################
|
70 |
################################################################################
|
69 |
|
71 |
|
Line 71... |
Line 73... |
71 |
[[ $(whoami) != 'root' ]] && errorExit 'Please run as root'
|
73 |
[[ $(whoami) != 'root' ]] && errorExit 'Please run as root'
|
72 |
[[ $ISO_IN == "" ]] && errorExit "No Mageia iso file in $RESSOURCES"
|
74 |
[[ $ISO_IN == "" ]] && errorExit "No Mageia iso file in $RESSOURCES"
|
73 |
[[ ! -f "$RESSOURCES/auto_inst.cfg.pl_template" ]] && errorExit "No auto_inst.cfg.pl_template file in $RESSOURCES"
|
75 |
[[ ! -f "$RESSOURCES/auto_inst.cfg.pl_template" ]] && errorExit "No auto_inst.cfg.pl_template file in $RESSOURCES"
|
74 |
[[ $ALCASAR_TARBALL == "" ]] && errorExit "No ALCASAR tarball file in $RESSOURCES"
|
76 |
[[ $ALCASAR_TARBALL == "" ]] && errorExit "No ALCASAR tarball file in $RESSOURCES"
|
75 |
|
77 |
|
76 |
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR $MAGEIA_OFFICIAL_DIR_EFI
|
78 |
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR
|
77 |
do
|
79 |
do
|
78 |
[ -d $directory ] || mkdir -p $directory
|
80 |
[ -d $directory ] || mkdir -p $directory
|
79 |
done
|
81 |
done
|
80 |
printBold "Mageiar will be build with Mageia-$MAGEIA_VERSION-$ARCH and $ALCASAR_EXTRACTED_DIR"
|
82 |
printBold "Mageiar will be build with Mageia-$MAGEIA_VERSION-$ARCH and $ALCASAR_EXTRACTED_DIR"
|
81 |
|
- |
|
82 |
# Retrieve list of installed RPM
|
83 |
# remove some rpm (if this script has been already run)
|
- |
|
84 |
urpme $ISO_RPM_LIST --auto-orphans --force 2>/dev/null
|
- |
|
85 |
# Retrieve list of installed RPM (without those that will be installed with the alcasar install script)
|
83 |
ALCASAR_RPM_LIST="$(dnf list installed | cut -d " " -f1 | rev | cut -d "." -f2- | rev | grep -Ev 'coova-chilli|gammu|lib64gammu8|ipt-netflow|nfdump|wkhtmltopdf' | tail -n +2 | tr '\n' ' ')"
|
86 |
ALCASAR_RPM_LIST="$(dnf list installed | cut -d " " -f1 | rev | cut -d "." -f2- | rev | grep -Ev 'coova-chilli|gammu|lib64gammu8|ipt-netflow|nfdump|wkhtmltopdf' | tail -n +2 | tr '\n' ' ')"
|
84 |
# agregate & clean rpm list
|
87 |
# agregate & clean rpm list
|
85 |
RPM_LIST=$(echo $BASE_RPM_LIST $ALCASAR_RPM_LIST | sed "s/ /\n/g" | sort | uniq | sed "s/\n/ /g")
|
88 |
RPM_LIST=$(echo $BASE_RPM_LIST $ALCASAR_RPM_LIST | sed "s/ /\n/g" | sort | uniq | sed "s/\n/ /g")
|
86 |
|
89 |
|
87 |
# Insert list into AUTO_INSTALL_CFG
|
90 |
# Insert list into AUTO_INSTALL_CFG
|
Line 95... |
Line 98... |
95 |
echo "$formattedList" >> "$AUTO_INSTALL_CFG"
|
98 |
echo "$formattedList" >> "$AUTO_INSTALL_CFG"
|
96 |
echo "$fileBottom" >> "$AUTO_INSTALL_CFG"
|
99 |
echo "$fileBottom" >> "$AUTO_INSTALL_CFG"
|
97 |
|
100 |
|
98 |
# Installing tools to create the iso file
|
101 |
# Installing tools to create the iso file
|
99 |
printBold "Installing ISO building tools"
|
102 |
printBold "Installing ISO building tools"
|
100 |
dnf install 'dnf-command(download)' -y || errorExit "could not install necessary packages"
|
103 |
#dnf install 'dnf-command(download)' -y || errorExit "could not install necessary packages"
|
101 |
dnf install -y lftp wget cdrkit-genisoimage xorriso rpmtools syslinux || errorExit "could not install necessary packages"
|
104 |
#dnf install -y $ISO_RPM_LIST || errorExit "could not install necessary packages"
|
- |
|
105 |
urpmi $ISO_RPM_LIST --force|| errorExit "could not install necessary packages"
|
102 |
|
106 |
|
103 |
# Mounting the ISO image
|
107 |
# Mounting the ISO image
|
104 |
printBold "Mounting the image"
|
108 |
printBold "Mounting the image"
|
105 |
if [ `mount |grep $MAGEIA_OFFICIAL_DIR | wc -l` -eq 0 ]; then # if not already mounted
|
109 |
if [ `mount |grep $MAGEIA_OFFICIAL_DIR | wc -l` -eq 0 ]; then # if not already mounted
|
106 |
mount -o ro,loop $RESSOURCES/$ISO_IN $MAGEIA_OFFICIAL_DIR || errorExit "failed mounting $ISO_IN."
|
110 |
mount -o ro,loop $RESSOURCES/$ISO_IN $MAGEIA_OFFICIAL_DIR || errorExit "failed mounting $ISO_IN."
|
Line 125... |
Line 129... |
125 |
count=0
|
129 |
count=0
|
126 |
# Copying the RPM in core and clearing the plop.idx file
|
130 |
# Copying the RPM in core and clearing the plop.idx file
|
127 |
echo "Copying $total RPMS in ISO ..."
|
131 |
echo "Copying $total RPMS in ISO ..."
|
128 |
for rpm in ${RPM_LIST}; do
|
132 |
for rpm in ${RPM_LIST}; do
|
129 |
let percent="${count} * 100 / ${total}"
|
133 |
let percent="${count} * 100 / ${total}"
|
130 |
dnf download --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm"
|
134 |
# dnf download --downloaddir $coreDirNew $rpm 1> /dev/null || errorExit "could not download $rpm"
|
- |
|
135 |
#urpmi --no-install --replacepkgs -q $rpm 2> /dev/null || urpmi --no-install -q --force $rpm 2> /dev/null || echo "could not download $rpm"
|
131 |
printProgress ${percent}
|
136 |
printProgress ${percent}
|
132 |
count=$(expr ${count} + 1)
|
137 |
count=$(expr ${count} + 1)
|
133 |
done
|
138 |
done
|
134 |
printBold "$count RPMs copied"
|
139 |
printBold "$count RPMs copied"
|
135 |
|
- |
|
136 |
# Copying the Alcasar tarball & automatic install option into the ISO
|
140 |
# Copying the Alcasar tarball & automatic install option into the ISO
|
137 |
mkdir -p $INSTALLER_DIR || errorExit "could not create directory $INSTALLER_DIR"
|
141 |
mkdir -p $INSTALLER_DIR || errorExit "could not create directory $INSTALLER_DIR"
|
138 |
cp $RESSOURCES/$ALCASAR_TARBALL $INSTALLER_DIR || errorExit "could not copy $RESSOURCES/$ALCASAR_TARBALL to $INSTALLER_DIR"
|
142 |
cp $RESSOURCES/$ALCASAR_TARBALL $INSTALLER_DIR || errorExit "could not copy $RESSOURCES/$ALCASAR_TARBALL to $INSTALLER_DIR"
|
139 |
cp $AUTO_INSTALL_CFG $INSTALLER_DIR || errorExit "could not copy $AUTO_INSTALL_CFG to $INSTALLER_DIR"
|
143 |
cp $AUTO_INSTALL_CFG $INSTALLER_DIR || errorExit "could not copy $AUTO_INSTALL_CFG to $INSTALLER_DIR"
|
140 |
|
144 |
|
- |
|
145 |
mv $urpmi_cache/*.rpm $coreDirNew
|
141 |
# Generating media info for core
|
146 |
# Generating media info for core
|
142 |
echo "Generating media_info for core..."
|
147 |
echo "Generating media_info for core..."
|
143 |
genhdlist2 ${coreDirNew} --allow-empty-media --quiet
|
148 |
genhdlist2 ${coreDirNew} --allow-empty-media --quiet
|
144 |
echo "Generating media_info for nonfree..."
|
149 |
echo "Generating media_info for nonfree..."
|
145 |
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet
|
150 |
genhdlist2 ${nonFreeDirNew} --allow-empty-media --quiet
|
Line 185... |
Line 190... |
185 |
-o ${TMP_DIR}/${newIsoName} .
|
190 |
-o ${TMP_DIR}/${newIsoName} .
|
186 |
|
191 |
|
187 |
# Unmounting & Removing temporary dir
|
192 |
# Unmounting & Removing temporary dir
|
188 |
echo "Umounting..."
|
193 |
echo "Umounting..."
|
189 |
umount $MAGEIA_OFFICIAL_DIR
|
194 |
umount $MAGEIA_OFFICIAL_DIR
|
- |
|
195 |
mv $coreDirNew/*.rpm $urpmi_cache
|
190 |
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR $MAGEIA_OFFICIAL_DIR_EFI
|
196 |
for directory in $MAGEIA_NEW_DIR $MAGEIA_OFFICIAL_DIR
|
191 |
do
|
197 |
do
|
192 |
[ -d $directory ] && rm -rf $directory
|
198 |
[ -d $directory ] && rm -rf $directory
|
193 |
done
|
199 |
done
|
194 |
rm -f "$AUTO_INSTALL_CFG"
|
200 |
rm -f "$AUTO_INSTALL_CFG"
|
195 |
echo "Done."
|
201 |
echo "All RPM are always in '/var/cache/urpmi/rpms'Done. Remove them if nedded."
|