diff options
author | Olivier Blin <blino@mageia.org> | 2011-03-15 13:58:31 +0000 |
---|---|---|
committer | Olivier Blin <blino@mageia.org> | 2011-03-15 13:58:31 +0000 |
commit | 4c4328833cb84e7e5e4eccbb385c9d4851bfd7b5 (patch) | |
tree | f6d8d18d835eb7a25088d351663a29c5058532d5 /tools | |
download | draklive-config-4c4328833cb84e7e5e4eccbb385c9d4851bfd7b5.tar draklive-config-4c4328833cb84e7e5e4eccbb385c9d4851bfd7b5.tar.gz draklive-config-4c4328833cb84e7e5e4eccbb385c9d4851bfd7b5.tar.bz2 draklive-config-4c4328833cb84e7e5e4eccbb385c9d4851bfd7b5.tar.xz draklive-config-4c4328833cb84e7e5e4eccbb385c9d4851bfd7b5.zip |
import initial live config
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/compute-rpm-sizes.sh | 15 | ||||
-rwxr-xr-x | tools/install-mozilla-extension.sh | 46 | ||||
-rwxr-xr-x | tools/install-portable-mozilla.sh | 58 | ||||
-rwxr-xr-x | tools/langs-expand.pl | 6 | ||||
-rw-r--r-- | tools/live-lang | 39 | ||||
-rwxr-xr-x | tools/partition.sh | 41 | ||||
-rwxr-xr-x | tools/sync-trees.sh | 20 | ||||
-rw-r--r-- | tools/umount-live | 48 |
8 files changed, 273 insertions, 0 deletions
diff --git a/tools/compute-rpm-sizes.sh b/tools/compute-rpm-sizes.sh new file mode 100755 index 0000000..5425d3f --- /dev/null +++ b/tools/compute-rpm-sizes.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +chroot=$1 +name=$2 + +if [ -z "$chroot" ] || [ -z "$name" ]; then + echo "usage: $0 <chroot> <name>" +fi + +full=$name-full.lst +leaves=$name-leaves.lst +chroot $chroot sh -c "rpm -qa --qf '%{size} \t%{name}\n' | sort -n" > $full +chroot $chroot sh -c "urpmi_rpm-find-leaves | xargs rpm -q --qf '%{size} \t%{name}\n' | sort -n" > $leaves + +echo $full $leaves diff --git a/tools/install-mozilla-extension.sh b/tools/install-mozilla-extension.sh new file mode 100755 index 0000000..4bb4c3b --- /dev/null +++ b/tools/install-mozilla-extension.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +extpath=$1 +xpi=$2 + +if [ -z "$extpath" ]; then + echo "usage: $0 <mozilla extension path> [<xpi file>]" + exit 1 +fi + +xpi_dir="." +if [ -n "$xpi" ]; then + xpi_dir="`basename $xpi`.dir" + rm -rf $xpi_dir + mkdir -p $xpi_dir + unzip -q -d $xpi_dir $xpi +fi + +rdf="$xpi_dir/install.rdf" +if [ ! -f $rdf ]; then + echo "unable to find rdf file" + exit 1 +fi + +# remove leading newline from some broken rdf files (pt-PT) +perl -pi -e 's/^\r?\n// if $. == 1' $rdf + +hash="$(perl -pe 's/\r\n/\n/g' $rdf | sed -n '/.*em:id="\(.*\)"/{s//\1/p;q}')" +if [ -z "$hash" ]; then + hash="$(perl -pe 's/\r\n/\n/g' $rdf | sed -n '/.*em:id>\(.*\)<\/em:id>.*/{s//\1/p;q}')" +fi +if [ -z "$hash" ]; then + echo "Failed to find plugin hash." + exit 1 +fi + +echo "installing $hash in $extpath" + +extdir="$extpath/$hash" +rm -rf $extdir +mkdir -p "$extdir" +cp -af $xpi_dir/* "$extdir/" + +if [ -n "$xpi" ]; then + rm -rf $xpi_dir +fi diff --git a/tools/install-portable-mozilla.sh b/tools/install-portable-mozilla.sh new file mode 100755 index 0000000..5158ceb --- /dev/null +++ b/tools/install-portable-mozilla.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +mozapp=$1 +mozver=$2 +download=1 + +if [ -z "$mozapp" -o -z "$mozver" ]; then + echo "usage: $0 <mozilla application> <version>" +fi + +case "$mozapp" in + firefox) + sourceforgedir="portableapps/Mozilla Firefox, Portable Ed./Mozilla Firefox, Portable Edition $mozver" + installername=FirefoxPortable + portablename=FirefoxPortable + ;; + thunderbird) + sourceforgedir="portableapps/Mozilla Thunderbird, P.E./Mozilla Thunderbird, Portable Edition $mozver" + installername=ThunderbirdPortable + portablename=ThunderbirdPortable + ;; + *) + echo "invalid application: $mozapp" + exit 1 + ;; +esac + +installer="${installername}_${mozver}_English.paf.exe" +switchlocaleurl=https://addons.mozilla.org/en-US/firefox/downloads/file/16920/locale_switcher-2.1-fx+tb.xpi +switchlocalename=$(basename $switchlocaleurl) + +if [ -n "$download" ]; then + + wget -nc "http://freefr.dl.sourceforge.net/sourceforge/$sourceforgedir/$installer" + wget -nc $switchlocaleurl/$switchlocalename +fi + +xpi_url=http://releases.mozilla.org/pub/mozilla.org/$mozapp/releases/$mozver/win32/xpi/ +xpi_dir="${mozapp}-${mozver}-xpi" +extdir="${portablename}/App/DefaultData/profile/extensions" + +if [ -n "$download" ]; then + rm -rf $xpi_dir + mkdir -p $xpi_dir + lftp -e "lcd $xpi_dir; mget -c *.xpi; quit" $xpi_url +fi + +wine $installer + +bindir=$(dirname $0) +for ext in $switchlocalename $xpi_dir/*.xpi; do + $bindir/install-mozilla-extension.sh $extdir $ext +done + +mozexe="$portablename/$portablename.exe" +#- pre-create profile data, takes a long time on USB +wine $mozexe +# FIXME: run from key? (different path) diff --git a/tools/langs-expand.pl b/tools/langs-expand.pl new file mode 100755 index 0000000..2d0797b --- /dev/null +++ b/tools/langs-expand.pl @@ -0,0 +1,6 @@ +#!/usr/bin/perl -l +use lib qw(/usr/lib/libDrakX); +use lang; +use MDK::Common; +my @langs = grep { member(lang::locale_to_main_locale($_), @ARGV) } lang::list_langs(); +print join("\n", map { lang::l2name($_) . " (" . $_ . ")" } sort(@langs)); diff --git a/tools/live-lang b/tools/live-lang new file mode 100644 index 0000000..6772648 --- /dev/null +++ b/tools/live-lang @@ -0,0 +1,39 @@ +#!/usr/bin/perl +# +# + +use strict; +use lib qw(/usr/lib/libDrakX); +use common; +use lang; + +my @chroot = @ARGV; + +@chroot or usage(); + +foreach my $path (@chroot) { + my %done; + my $qa = `chroot $path rpm -qa`; + my @list; + foreach my $rpm (split "\n", $qa) { + my $l; + if ($rpm =~ /locales-([^-]+)-/) { + #$l = $1 + } elsif ($rpm =~ /(?:i18n|l10n|aspell)-([^-]+)-/) { + $l = $1 + } + if ($l && $lang::langs{$l} && !$done{$l}) { + $done{$l} = 1; + push @list,@{$lang::langs{$l}}[0] + } + } + print "$path: ", join(", ", sort @list), "\n" +} + +exit; + +sub usage { + print "\nusage:\n\n\t\tlive-lang <chroot install>\n\n"; + exit +} + diff --git a/tools/partition.sh b/tools/partition.sh new file mode 100755 index 0000000..2637797 --- /dev/null +++ b/tools/partition.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +DEVICE=$1 +LABEL=Share +if [ -z "$DEVICE" ]; then + echo "No device" + exit 1 +fi + +# FT +#END1=780 +#END2=1950 + +#END1=380 +#END2=1022 + +END1=25000 +END2=60869 + +fdisk $DEVICE <<EOF +o +n +p +1 + +$END1 +n +p +2 + +$END2 +t +1 +b +t +2 +b +w +EOF + +mkdosfs -n $LABEL ${DEVICE}1 diff --git a/tools/sync-trees.sh b/tools/sync-trees.sh new file mode 100755 index 0000000..8eea0f6 --- /dev/null +++ b/tools/sync-trees.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +#MEDIA=/media/non-free/release +[ -n "$1" ] && DRY_RUN=-n +DIST=/cooker/i586 +ROOT=$DIST$MEDIA +SOURCE=/live/mnt/BIG/dis/devel$ROOT +DEST=/mnt/field/dis/local$ROOT +TEST=media/main/release/media_info/UPDATING + +rsync $DRY_RUN -avP -lHz -e 'ssh -xc arcfour' --delete --delete-excluded --exclude 'debug_*/*/*' --exclude SRPMS $SOURCE/ $DEST + +if [ -e "$DEST/$TEST" ]; then + echo + echo "Warning: package upload in progress" + echo "Resync tree!" + exit 1 +fi + +exit 0 diff --git a/tools/umount-live b/tools/umount-live new file mode 100644 index 0000000..098c82e --- /dev/null +++ b/tools/umount-live @@ -0,0 +1,48 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: umount-live +# Default-Stop: 0 6 +# Should-Stop: $remote_fs +# Short-Description: Umounts live-system-specific mountpoints on +#halt/reboot +# Description: This service umounts live-system-specific mountpoints +#on halt/reboot. +### END INIT INFO + +mypath=$_ + +case "$1" in + *start) + ;; + *stop) + exit + ;; + *) + gprintf "Usage: %s\n" "$(basename $0) {start}" + exit 1 + ;; +esac + +roottype=`awk '$2 == "/" { print $3 }' /etc/fstab` + +if [ "$roottype" != unionfs ]; then + # disable self during first halt when installed + chkconfig --del $(basename $0) + #rm -f $mypath + exit +fi + +maybe_umount() { + eval d=\$$# + [ -e $d ] && umount $@ +} + +maybe_umount -l /live/distrib +maybe_umount -l /live/memory +maybe_umount -l /live/system +maybe_umount -l /live/media + +maybe_umount /var/lib/rpm +maybe_umount /tmp/rpm/real +maybe_umount /tmp/rpm |