makedist: sync all changes to date
This commit is contained in:
parent
c15983073f
commit
114bd9c94d
@ -125,7 +125,7 @@ ALTREPNUM=`expr ${#REPOSITORY[*]} - 2`
|
|||||||
for c in `seq 0 $ALTREPNUM`; do
|
for c in `seq 0 $ALTREPNUM`; do
|
||||||
echo "
|
echo "
|
||||||
[makedist${c}]
|
[makedist${c}]
|
||||||
DESCRIPTION = makedsit repository ${c}
|
DESCRIPTION = makedist repository ${c}
|
||||||
REPOSITORY_DIR = ${REPOSITORY[$c]}" >> $LOCALSTATEDIR/distromatic/distromatic.conf
|
REPOSITORY_DIR = ${REPOSITORY[$c]}" >> $LOCALSTATEDIR/distromatic/distromatic.conf
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -12,6 +12,45 @@ function prelink() {
|
|||||||
chroot $MOUNTDIR /sbin/ldconfig
|
chroot $MOUNTDIR /sbin/ldconfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function i18n_add_all_languages() {
|
||||||
|
# add localedata for all supported languages (requires glibc-i18ndata installed)
|
||||||
|
echo -n "Generating locales archive for all supported languages..."
|
||||||
|
cat $MOUNTDIR/usr/share/i18n/locales/SUPPORTED | sed "s|\\\||" | \
|
||||||
|
while read line; do
|
||||||
|
LOCALE=${line/\/*}
|
||||||
|
LOCALEPREFIX=${LOCALE/.*}
|
||||||
|
ENCODING=${line/*\/}
|
||||||
|
[ "$LOCALE" != "$ENCODING" ] || continue
|
||||||
|
chroot $MOUNTDIR localedef -i $LOCALEPREFIX -f $ENCODING $LOCALE
|
||||||
|
echo -n "$line "
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
function i18n_add_languages_from_file() {
|
||||||
|
# add localedata for extra requested languages from input file (requires glibc-i18ndata installed)
|
||||||
|
echo -n "Generating locales archive for requested languages..."
|
||||||
|
cat $TARGETDIR/platforms/$PLATFORM/languages | \
|
||||||
|
while read REQUESTED_LANG; do
|
||||||
|
lines=`grep -i "^${REQUESTED_LANG}[./@]" $MOUNTDIR/usr/share/i18n/locales/SUPPORTED`
|
||||||
|
if [ ! "$lines" ]; then
|
||||||
|
echo
|
||||||
|
echo "Warning: requested language $REQUESTED_LANG not found in supported languages; skipping."
|
||||||
|
else
|
||||||
|
echo $lines | sed "s|\\\||g" | \
|
||||||
|
for line in $lines; do
|
||||||
|
LOCALE=${line/\/*}
|
||||||
|
LOCALEPREFIX=${LOCALE/.*}
|
||||||
|
ENCODING=${line/*\/}
|
||||||
|
[ "$LOCALE" != "$ENCODING" ] || continue
|
||||||
|
chroot $MOUNTDIR localedef -i $LOCALEPREFIX -f $ENCODING $LOCALE
|
||||||
|
echo -n "$line "
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
function create_rpm_database() {
|
function create_rpm_database() {
|
||||||
# RPM database initialization
|
# RPM database initialization
|
||||||
#
|
#
|
||||||
@ -69,9 +108,22 @@ function clean_rpm_database() {
|
|||||||
|
|
||||||
function erase_rpm_database() {
|
function erase_rpm_database() {
|
||||||
echo "Erasing rpm database"
|
echo "Erasing rpm database"
|
||||||
|
[ "$RPM_OCCUPACY_STATS_FILE" ] || rpm_occupacy_stats
|
||||||
[ "$MOUNTDIR" != "" -a "$MOUNTDIR" != "/" ] && rm -rf $MOUNTDIR/var/lib/rpm
|
[ "$MOUNTDIR" != "" -a "$MOUNTDIR" != "/" ] && rm -rf $MOUNTDIR/var/lib/rpm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rpm_occupacy_stats() {
|
||||||
|
RPM_OCCUPACY_STATS_FILE=`mktemp`
|
||||||
|
SIZE=0
|
||||||
|
rpm -r $MOUNTDIR -qa --queryformat "%{SIZE} %{NAME}\n" | sort -k1 -n -r > $RPM_OCCUPACY_STATS_FILE
|
||||||
|
while read line; do
|
||||||
|
set -- $line
|
||||||
|
SIZE=`expr $SIZE + $1`
|
||||||
|
done < $RPM_OCCUPACY_STATS_FILE
|
||||||
|
# echo "-------------------------" >> $RPM_OCCUPACY_STATS_FILE
|
||||||
|
# echo "$SIZE \tTotal size" >> $RPM_OCCUPACY_STATS_FILE
|
||||||
|
}
|
||||||
|
|
||||||
function set_rpm_dirs() {
|
function set_rpm_dirs() {
|
||||||
|
|
||||||
for r in ${RPMDIR[*]}; do
|
for r in ${RPMDIR[*]}; do
|
||||||
@ -80,7 +132,7 @@ function set_rpm_dirs() {
|
|||||||
|
|
||||||
if [ "$arch_fallback" ]; then
|
if [ "$arch_fallback" ]; then
|
||||||
for r in ${RPMDIR[*]}; do
|
for r in ${RPMDIR[*]}; do
|
||||||
RPM_DIRS="${r}${arch_fallback}/ $RPM_DIRS"
|
RPM_DIRS="$RPM_DIRS ${r}${arch_fallback}/"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -150,6 +202,7 @@ function get_rpm_version() {
|
|||||||
#find $NOARCHDIR -regex ".*/${1//+/\\+}-[^-]*-[^-]*" | sed "s|.*/${1//+/\\+}-\([^-]*\)-[^-]*|\1|"
|
#find $NOARCHDIR -regex ".*/${1//+/\\+}-[^-]*-[^-]*" | sed "s|.*/${1//+/\\+}-\([^-]*\)-[^-]*|\1|"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# wget_grep()
|
# wget_grep()
|
||||||
#
|
#
|
||||||
# parameters:
|
# parameters:
|
||||||
@ -182,8 +235,6 @@ function wget_grep() {
|
|||||||
# $1 : kernel extraver
|
# $1 : kernel extraver
|
||||||
function install_kernel() {
|
function install_kernel() {
|
||||||
# installing kernel image, modules and utilities
|
# installing kernel image, modules and utilities
|
||||||
# note: it is safe and better to give --scripts and --nodeps
|
|
||||||
# because kernel doesn't have dependencies itself
|
|
||||||
KERNEL_BASENAME="kernel"
|
KERNEL_BASENAME="kernel"
|
||||||
|
|
||||||
[ "$1" ] && {
|
[ "$1" ] && {
|
||||||
@ -193,14 +244,29 @@ function install_kernel() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
install_rpms_by_target "\
|
if [ "$KERNEL_NOPREPARATION" != "1" ]; then
|
||||||
|
install_rpms_by_target "\
|
||||||
|
Installing and preparing dracut for kernel install..." \
|
||||||
|
"dracut module-init-tools"
|
||||||
|
|
||||||
|
for f in /usr/sbin/dracut /usr/sbin/mkinitrd /sbin/depmod; do
|
||||||
|
mv ${MOUNTDIR}${f} ${MOUNTDIR}${f}.preinst
|
||||||
|
ln -s /bin/true ${MOUNTDIR}${f}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAKE_RESOLVE_ADD="KERNEL_EXTRAVER=$1" install_rpms_by_target "\
|
||||||
Installing kernel image (${KERNEL_VER}$1), modules and utilities..." \
|
Installing kernel image (${KERNEL_VER}$1), modules and utilities..." \
|
||||||
"$KERNEL_TARGET"
|
"$KERNEL_TARGET"
|
||||||
# \
|
MAKE_RESOLVE_ADD=
|
||||||
# "--noscripts --nodeps"
|
|
||||||
|
if [ "$KERNEL_NOPREPARATION" != "1" ]; then
|
||||||
|
for f in /usr/sbin/dracut /usr/sbin/mkinitrd /sbin/depmod; do
|
||||||
|
rm ${MOUNTDIR}${f}
|
||||||
|
mv ${MOUNTDIR}${f}.preinst ${MOUNTDIR}${f}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# create /sys directory
|
|
||||||
mkdir -p $MOUNTDIR/sys
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# update_modules_dependencies()
|
# update_modules_dependencies()
|
||||||
@ -310,6 +376,8 @@ mv \$MOUNTDIR/sbin/install-info.preinst \$MOUNTDIR/sbin/install-info
|
|||||||
" >> ${LOCALSTATEDIR}/${BUILDSCRIPT_NAME}
|
" >> ${LOCALSTATEDIR}/${BUILDSCRIPT_NAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ "$RPM_OCCUPACY_STATS_FILE" ] || rpm_occupacy_stats
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# install_rpms()
|
# install_rpms()
|
||||||
@ -333,6 +401,8 @@ LANG=${LANGUAGE}_${COUNTRY}.UTF-8 $RPM --ignorearch -r \$MOUNTDIR -hiv $rpmextra
|
|||||||
echo "$makedist_me: fatal error, aborting installation" >&2
|
echo "$makedist_me: fatal error, aborting installation" >&2
|
||||||
echo "$makedist_me: exit code was: $retcode" >&2
|
echo "$makedist_me: exit code was: $retcode" >&2
|
||||||
echo "$makedist_me: command was: LANG=${LANGUAGE}_${COUNTRY}.UTF-8 $RPM --ignorearch -r $MOUNTDIR -hiv $rpmextraargs $2 $TOINSTALL_RPMS" >&2
|
echo "$makedist_me: command was: LANG=${LANGUAGE}_${COUNTRY}.UTF-8 $RPM --ignorearch -r $MOUNTDIR -hiv $rpmextraargs $2 $TOINSTALL_RPMS" >&2
|
||||||
|
echo "$makedist_me: sleeping 600 seconds"
|
||||||
|
sleep 600
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
|
|
||||||
INSTALLED="$INSTALLED $1"
|
INSTALLED="$INSTALLED $1"
|
||||||
@ -357,7 +427,7 @@ function resolve_pkg_deps() {
|
|||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
|
|
||||||
cmd="make --no-print-directory ARCH=$arch -C $GLOBALDIR CHROOTCMD=\"$CHROOTCMD\" \
|
cmd="make --no-print-directory ARCH=$arch -C $GLOBALDIR CHROOTCMD=\"$CHROOTCMD\" \
|
||||||
LANGUAGE=$LANGUAGE INSTALLED=\"$1\" TARGET=$MAKEFILE_TARGET PLATFORM='$PLATFORM' -s $2"
|
LANGUAGE=$LANGUAGE INSTALLED=\"$1\" TARGET=$MAKEFILE_TARGET PLATFORM='$PLATFORM' $MAKE_RESOLVE_ADD -s $2"
|
||||||
[ "$VERBOSE" ] && {
|
[ "$VERBOSE" ] && {
|
||||||
echo
|
echo
|
||||||
echo "Executing command: $cmd" >&2
|
echo "Executing command: $cmd" >&2
|
||||||
@ -736,7 +806,13 @@ function write_installed_packages_info() {
|
|||||||
|
|
||||||
[ -e $OUTLISTFILE ] && rm -f $OUTLISTFILE
|
[ -e $OUTLISTFILE ] && rm -f $OUTLISTFILE
|
||||||
echo "FILESIZE=\"$FILESIZE\"" > $OUTLISTFILE
|
echo "FILESIZE=\"$FILESIZE\"" > $OUTLISTFILE
|
||||||
echo "INSTALLED=\"$INSTALLED\"" > $OUTLISTFILE
|
echo "INSTALLED=\"$INSTALLED\"" >> $OUTLISTFILE
|
||||||
|
[ "$RPM_OCCUPACY_STATS_FILE" -a -e "$RPM_OCCUPACY_STATS_FILE" ] && {
|
||||||
|
echo "RPMOCCUPACY=\"" >> $OUTLISTFILE
|
||||||
|
cat $RPM_OCCUPACY_STATS_FILE >> $OUTLISTFILE
|
||||||
|
echo "\"" >> $OUTLISTFILE
|
||||||
|
rm $RPM_OCCUPACY_STATS_FILE
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$INSTALLED" ]; then
|
if [ "$INSTALLED" ]; then
|
||||||
cmd="make --no-print-directory ARCH=$arch -C $GLOBALDIR SOURCESMODE=1 -s $INSTALLED"
|
cmd="make --no-print-directory ARCH=$arch -C $GLOBALDIR SOURCESMODE=1 -s $INSTALLED"
|
||||||
@ -844,9 +920,15 @@ function medium_name() {
|
|||||||
archive|ARCHIVE|archive_bz2|ARCHIVE_BZ2)
|
archive|ARCHIVE|archive_bz2|ARCHIVE_BZ2)
|
||||||
MEDIUM_NAME=$MEDIUM_NAME.$arch.tar.bz2
|
MEDIUM_NAME=$MEDIUM_NAME.$arch.tar.bz2
|
||||||
;;
|
;;
|
||||||
|
archive_xz|ARCHIVE_XZ)
|
||||||
|
MEDIUM_NAME=$MEDIUM_NAME.$arch.tar.xz
|
||||||
|
;;
|
||||||
cpio|CPIO)
|
cpio|CPIO)
|
||||||
MEDIUM_NAME=$MEDIUM_NAME.$arch.cpio.gz
|
MEDIUM_NAME=$MEDIUM_NAME.$arch.cpio.gz
|
||||||
;;
|
;;
|
||||||
|
cpio_xz|CPIO_XZ)
|
||||||
|
MEDIUM_NAME=$MEDIUM_NAME.$arch.cpio.xz
|
||||||
|
;;
|
||||||
squash*|SQUASH*)
|
squash*|SQUASH*)
|
||||||
MEDIUM_NAME=$MEDIUM_NAME.$arch.sqsh
|
MEDIUM_NAME=$MEDIUM_NAME.$arch.sqsh
|
||||||
;;
|
;;
|
||||||
@ -878,6 +960,7 @@ function medium_name() {
|
|||||||
echo $MEDIUM_NAME
|
echo $MEDIUM_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# produce_media()
|
# produce_media()
|
||||||
#
|
#
|
||||||
# $1: media name (default: detect using medium_name function)
|
# $1: media name (default: detect using medium_name function)
|
||||||
@ -888,22 +971,35 @@ function produce_media() {
|
|||||||
|
|
||||||
[ -e $MOUNTDIR/proc/version ] && umount $MOUNTDIR/proc
|
[ -e $MOUNTDIR/proc/version ] && umount $MOUNTDIR/proc
|
||||||
|
|
||||||
|
TARGETSIZE=`du -sh $MOUNTDIR | sed "s|[[:space:]].*||"`
|
||||||
|
echo "Uncompressed occupacy size is: ${TARGETSIZE}"
|
||||||
|
|
||||||
case $MEDIA in
|
case $MEDIA in
|
||||||
archive_gz|ARCHIVE_GZ)
|
archive_gz|ARCHIVE_GZ)
|
||||||
echo "Producing rootfs compressed archive $MEDIUM_FILENAME..."
|
echo "Producing rootfs compressed archive $MEDIUM_FILENAME..."
|
||||||
(cd $MOUNTDIR
|
(cd $MOUNTDIR
|
||||||
tar czf $LOCALSTATEDIR/$MEDIUM_FILENAME *)
|
tar czf $LOCALSTATEDIR/$MEDIUM_FILENAME *)
|
||||||
;;
|
;;
|
||||||
archive|ARCHIVE)
|
archive|ARCHIVE|archive_bz2|ARCHIVE_BZ2)
|
||||||
echo "Producing rootfs compressed archive $MEDIUM_FILENAME..."
|
echo "Producing rootfs compressed archive $MEDIUM_FILENAME..."
|
||||||
(cd $MOUNTDIR
|
(cd $MOUNTDIR
|
||||||
tar cjf $LOCALSTATEDIR/$MEDIUM_FILENAME *)
|
tar cjf $LOCALSTATEDIR/$MEDIUM_FILENAME *)
|
||||||
;;
|
;;
|
||||||
|
archive_xz|ARCHIVE_XZ)
|
||||||
|
echo "Producing rootfs compressed archive $MEDIUM_FILENAME..."
|
||||||
|
(cd $MOUNTDIR
|
||||||
|
tar cJf $LOCALSTATEDIR/$MEDIUM_FILENAME *)
|
||||||
|
;;
|
||||||
cpio|CPIO)
|
cpio|CPIO)
|
||||||
echo "Producing rootfs compressed cpio image $MEDIUM_FILENAME..."
|
echo "Producing rootfs compressed cpio image $MEDIUM_FILENAME..."
|
||||||
(cd $MOUNTDIR
|
(cd $MOUNTDIR
|
||||||
find . -print | cpio -o -Hnewc | gzip -c > $LOCALSTATEDIR/$MEDIUM_FILENAME )
|
find . -print | cpio -o -Hnewc | gzip -c > $LOCALSTATEDIR/$MEDIUM_FILENAME )
|
||||||
;;
|
;;
|
||||||
|
cpio_xz|CPIO_XZ)
|
||||||
|
echo "Producing rootfs compressed cpio image $MEDIUM_FILENAME..."
|
||||||
|
(cd $MOUNTDIR
|
||||||
|
find . -print | cpio -o -Hnewc | xz -c > $LOCALSTATEDIR/$MEDIUM_FILENAME )
|
||||||
|
;;
|
||||||
squash|SQUASH)
|
squash|SQUASH)
|
||||||
echo "Producing squashfs (default) compressed filesystem image $MEDIUM_FILENAME..."
|
echo "Producing squashfs (default) compressed filesystem image $MEDIUM_FILENAME..."
|
||||||
mksquashfs $MOUNTDIR $LOCALSTATEDIR/$MEDIUM_FILENAME -noappend
|
mksquashfs $MOUNTDIR $LOCALSTATEDIR/$MEDIUM_FILENAME -noappend
|
||||||
|
@ -134,17 +134,6 @@ CHROOTCMD="chroot $MOUNTDIR"
|
|||||||
# note: some non-SMP machines are unable to boot with a SMP kernel
|
# note: some non-SMP machines are unable to boot with a SMP kernel
|
||||||
KERNEL_EXTRAVER=
|
KERNEL_EXTRAVER=
|
||||||
|
|
||||||
# set BUILDARCH
|
|
||||||
BUILDARCH=`uname -m`
|
|
||||||
|
|
||||||
case $BUILDARCH in
|
|
||||||
i386|i486|i586|i686|athlon) BUILDARCH=i586 ;;
|
|
||||||
arm*) BUILDARCH=arm ;;
|
|
||||||
*) echo "Error: build architecture $BUILDARCH is unknown; aborting."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# load some target specific settings
|
# load some target specific settings
|
||||||
. $TARGETDIR/settings.inc
|
. $TARGETDIR/settings.inc
|
||||||
@ -213,11 +202,19 @@ if [ ! "$KERNEL_IGNORE" ]; then
|
|||||||
{ echo "$makedist_me: cannot get KERNEL_VER" >&2
|
{ echo "$makedist_me: cannot get KERNEL_VER" >&2
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
echo "Found Linux kernel version ${KERNEL_VER}${KERNEL_EXTRAVER}"
|
echo "Found Linux kernel version ${KERNEL_VER}${KERNEL_EXTRAVER}"
|
||||||
KERNEL_MAJVER=`echo $KERNEL_VER | cut -d. -f1-3`
|
if [ "${KERNEL_VER:0:1}" = "2" ]; then
|
||||||
|
# kernel major release = 2
|
||||||
|
KERNEL_MAJVER=`echo $KERNEL_VER | cut -d. -f1-3`
|
||||||
|
else
|
||||||
|
# kernel major release >= 3
|
||||||
|
KERNEL_MAJVER=`echo $KERNEL_VER | cut -d. -f1-2`
|
||||||
|
fi
|
||||||
echo "
|
echo "
|
||||||
KERNEL_PLATFORM=${KERNEL_PLATFORM}
|
KERNEL_PLATFORM=${KERNEL_PLATFORM}
|
||||||
KERNEL_EXTRAVER=${KERNEL_EXTRAVER}" >> /var/makedist/.defs.inc
|
KERNEL_EXTRAVER=${KERNEL_EXTRAVER}" >> /var/makedist/.defs.inc
|
||||||
|
if [ "$KERNEL_MORE_EXTRAVER" ]; then
|
||||||
|
echo "KERNEL_MORE_EXTRAVER=${KERNEL_MORE_EXTRAVER}" >> /var/makedist/.defs.inc
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Skipping kernel check"
|
echo "Skipping kernel check"
|
||||||
fi
|
fi
|
||||||
@ -324,6 +321,7 @@ mkdir -p $MOUNTDIR/dev
|
|||||||
mknod --mode=0600 initctl p
|
mknod --mode=0600 initctl p
|
||||||
mknod -m666 null c 1 3
|
mknod -m666 null c 1 3
|
||||||
mknod -m600 console c 5 1
|
mknod -m600 console c 5 1
|
||||||
|
mknod -m444 urandom c 1 9
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user