- mount a tmpfs for root filesystem to speed up operations
This commit is contained in:
parent
4ffd3c128d
commit
a530e4956d
@ -1 +1 @@
|
||||
makedist_version=2.3
|
||||
makedist_version=2.4
|
||||
|
@ -15,12 +15,27 @@ function prelink() {
|
||||
function create_rpm_database() {
|
||||
# RPM database initialization
|
||||
#
|
||||
echo "RPM database initialization..."
|
||||
echo "Mounting tmpfs on MOUNTDIR (size=$MOUNTDIR_TMPFS_SIZE)..."
|
||||
[ "$MOUNTDIR" == "" -o "$MOUNTDIR" == "/" ] && {
|
||||
echo "$makedist_me: dangerous: MOUNTDIR is empty, aborting."
|
||||
exit 1;
|
||||
}
|
||||
|
||||
[ "$MOUNTDIR_TMPFS" ] && umount $MOUNTDIR_TMPFS
|
||||
MOUNTDIR_TMPFS=$MOUNTDIR
|
||||
umount $MOUNTDIR 2>/dev/null
|
||||
mount tmpfs $MOUNTDIR -t tmpfs -o size=$MOUNTDIR_TMPFS_SIZE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Warning: error $? mounting tmpfs on $MOUNTDIR"
|
||||
MOUNTDIR_TMPFS=
|
||||
fi
|
||||
|
||||
mkdir $MOUNTDIR/proc
|
||||
mount -o bind /proc $MOUNTDIR/proc
|
||||
trap "[ -e $MOUNTDIR/proc/version ] && umount $MOUNTDIR/proc; [ \"$MOUNTDIR_TMPFS\" ] && umount $MOUNTDIR_TMPFS" 0 HUP INT QUIT ABRT KILL TERM
|
||||
|
||||
echo "RPM database initialization..."
|
||||
|
||||
[ -e $MOUNTDIR/var/lib/rpm ] && rm -rf $MOUNTDIR/var/lib/rpm
|
||||
|
||||
[ "$MEDIUM_NAME" ] || MEDIUM_NAME=`medium_name`
|
||||
@ -871,6 +886,8 @@ function produce_media() {
|
||||
|
||||
[ "$1" ] && MEDIUM_FILENAME=$1 || MEDIUM_FILENAME=`medium_name`
|
||||
|
||||
[ -e $MOUNTDIR/proc/version ] && umount $MOUNTDIR/proc
|
||||
|
||||
case $MEDIA in
|
||||
archive_gz|ARCHIVE_GZ)
|
||||
echo "Producing rootfs compressed archive $MEDIUM_FILENAME..."
|
||||
@ -899,6 +916,10 @@ function produce_media() {
|
||||
echo "Producing squashfs (LZO) compressed filesystem image $MEDIUM_FILENAME..."
|
||||
mksquashfs $MOUNTDIR $LOCALSTATEDIR/$MEDIUM_FILENAME -comp lzo -noappend
|
||||
;;
|
||||
squash_xz|SQUASH_XZ)
|
||||
echo "Producing squashfs (XZ) compressed filesystem image $MEDIUM_FILENAME..."
|
||||
mksquashfs $MOUNTDIR $LOCALSTATEDIR/$MEDIUM_FILENAME -comp xz -noappend
|
||||
;;
|
||||
iso|ISO)
|
||||
echo "Producing ISO image $MEDIUM_FILENAME..."
|
||||
[ -e $MOUNTDIR/boot/isolinux/isolinux.bin ] && \
|
||||
@ -1002,9 +1023,7 @@ _EOF
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
write_installed_packages_info $MEDIUM_FILENAME
|
||||
|
||||
}
|
||||
|
||||
function make_rpm_first_time_script() {
|
||||
|
@ -116,9 +116,9 @@ esac
|
||||
|
||||
TARGETDIR=$TARGETSDIR/$MAKEDIST_TARGET
|
||||
MOUNTDIR=$LOCALSTATEDIR/root.tmp
|
||||
|
||||
# Auxiliary mountdir
|
||||
MOUNTDIR2=$LOCALSTATEDIR/root2.tmp
|
||||
MOUNTDIR_TMPFS_SIZE=8G
|
||||
|
||||
[ -d $MOUNTDIR ] && rm -rf $MOUNTDIR
|
||||
mkdir -p $MOUNTDIR
|
||||
@ -222,28 +222,6 @@ else
|
||||
echo "Skipping kernel check"
|
||||
fi
|
||||
|
||||
# remove CVS entries from utilsdir
|
||||
find $UTILSDIR -name CVS -type d -print | xargs rm -rf
|
||||
|
||||
# Updating .mo files (i18n support)
|
||||
[ -e $UTILSDIR/po ] && {
|
||||
echo "Updating i18n files..."
|
||||
languages="`find $UTILSDIR/po -mindepth 1 -maxdepth 1 -type d \
|
||||
-path '*/CVS' -prune -o -print | sed -n 's/.*\///p'`"
|
||||
echo "Checking for catalogs... $languages"
|
||||
for language in $languages; do
|
||||
rm -f $UTILSDIR/locale/$language/LC_MESSAGES/*
|
||||
let i=0
|
||||
for pof in `find $UTILSDIR/po/$language -name *.po -printf "%f "`; do
|
||||
mof="`echo $pof | sed 's/\(.*\).po/\1.mo/'`"
|
||||
msgfmt -o $UTILSDIR/locale/$language/LC_MESSAGES/$mof \
|
||||
$UTILSDIR/po/$language/$pof || exit 1
|
||||
let i+=1
|
||||
done
|
||||
echo " - Updated i18n files ($i files) for language $language..."
|
||||
done
|
||||
}
|
||||
|
||||
# execute distromatic
|
||||
[ "$DISTROMATIC" != "off" ] && exec_distromatic
|
||||
|
||||
|
110
obsoleted/isodiff.sh
Executable file
110
obsoleted/isodiff.sh
Executable file
@ -0,0 +1,110 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# openmamba ISO RPM differences report creator
|
||||
# Copyright (c) 2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
#
|
||||
TMPDIR=/tmp/isodiff
|
||||
|
||||
function create_count_files() {
|
||||
local F=$1
|
||||
SIZE=0
|
||||
rpm -r $TMPDIR/$F -qa --queryformat "%{NAME} %{SIZE}\n" | sort > $TMPDIR/$F-rpm.txt
|
||||
> $TMPDIR/$F-rpm-size.txt
|
||||
while read line; do
|
||||
set -- $line
|
||||
SIZE=`expr $SIZE + $2`
|
||||
echo "$1 $SIZE" >> $TMPDIR/$F-rpm-size.txt
|
||||
done < $TMPDIR/$F-rpm.txt
|
||||
echo "Total size: $SIZE"
|
||||
}
|
||||
|
||||
ISOFROM=$1
|
||||
ISOTO=$2
|
||||
|
||||
[ "$ISOFROM" -a "$ISOTO" ] || {
|
||||
echo "Usage: $0 from.iso to.iso"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -e "$ISOFROM" ] || {
|
||||
echo "Error: file $ISOFROM does not exist; aborting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -e "$ISOTO" ] || {
|
||||
echo "Error: file $ISOTO does not exist; aborting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
umount $TMPDIR/from 2>/dev/null
|
||||
umount $TMPDIR/to 2>/dev/null
|
||||
umount $TMPDIR/isofrom 2>/dev/null
|
||||
umount $TMPDIR/isoto 2>/dev/null
|
||||
|
||||
mkdir -p $TMPDIR/{isofrom,isoto,from,to}
|
||||
mount -o loop $ISOFROM $TMPDIR/isofrom || {
|
||||
echo "Error: cannot mount $ISOFROM; aborting."
|
||||
exit 1
|
||||
}
|
||||
mount -o loop $ISOTO $TMPDIR/isoto || {
|
||||
echo "Error: cannot mount $ISOTO; aborting."
|
||||
umount $TMPDIR/isofrom
|
||||
exit 1
|
||||
}
|
||||
mount -o loop $TMPDIR/isofrom/rootfs.compressed $TMPDIR/from || {
|
||||
echo "Error: cannot mount compressed fs inside $ISOFROM; aborting."
|
||||
umount $TMPDIR/isofrom
|
||||
umount $TMPDIR/isoto
|
||||
exit 1
|
||||
}
|
||||
mount -o loop $TMPDIR/isoto/rootfs.compressed $TMPDIR/to || {
|
||||
echo "Error: cannot mount compressed fs inside $ISOTO; aborting."
|
||||
umount $TMPDIR/from
|
||||
umount $TMPDIR/isofrom
|
||||
umount $TMPDIR/isoto
|
||||
exit 1
|
||||
}
|
||||
|
||||
create_count_files from
|
||||
create_count_files to
|
||||
|
||||
> $TMPDIR/diff.txt
|
||||
while read line; do
|
||||
set -- $line
|
||||
pkgname=$1
|
||||
fromsize=$2
|
||||
lineto=`grep "^$pkgname " $TMPDIR/to-rpm.txt 2>/dev/null`
|
||||
[ "$lineto" ] && {
|
||||
set -- $lineto
|
||||
tosize=$2
|
||||
} || tosize=0
|
||||
diffsize=`expr $tosize - $fromsize`
|
||||
[ $diffsize -ne 0 ] && {
|
||||
percsize=`echo "scale=2; $diffsize * 100 / $fromsize" | bc` || percsize=0
|
||||
echo -e "$pkgname ${tosize} ${fromsize} ${diffsize} ${percsize}" >> $TMPDIR/diff.txt
|
||||
}
|
||||
done < $TMPDIR/from-rpm.txt
|
||||
|
||||
while read line; do
|
||||
set -- $line
|
||||
pkgname=$1
|
||||
tosize=$2
|
||||
linefrom=`grep "^$pkgname " $TMPDIR/from-rpm.txt 2>/dev/null`
|
||||
[ "$linefrom" ] && continue
|
||||
echo -e "$pkgname $tosize 0 $tosize 100" >> $TMPDIR/diff.txt
|
||||
done < $TMPDIR/to-rpm.txt
|
||||
|
||||
echo -e "Package\r\t\t\t\t\t N Diff (bytes)" > $TMPDIR/diff-growth.txt
|
||||
echo "------------------------------------------------------------------------------------" >> $TMPDIR/diff-growth.txt
|
||||
incr=0
|
||||
cat $TMPDIR/diff.txt | sort -n -k 4 -r | while read line; do
|
||||
set -- $line
|
||||
[ ${3} -eq 0 ] && new="*" || new=" "
|
||||
incr=`expr $incr + ${4}`
|
||||
echo -e "$1\r\t\t\t\t\t ${new} ${4}\r\t\t\t\t\t\t\t (${5}%)\r\t\t\t\t\t\t\t\t\t $incr" >> $TMPDIR/diff-growth.txt
|
||||
done
|
||||
umount $TMPDIR/from
|
||||
umount $TMPDIR/to
|
||||
umount $TMPDIR/isofrom
|
||||
umount $TMPDIR/isoto
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user