You are not logged in.

#1 2008-10-03 12:18:28

godane
Member
From: NH, USA
Registered: 2008-02-03
Posts: 241
Website

Making a modular database for archiso-live (Competed)

I'm looking at making a modular database for archiso-live. The idea is to be able to have everything has a module besides the base and livecd tools need to boot to cmdline. But I need some help.

[b]modatabase script: [/b]
#!/bin/bash

if [ -e $1/archlive.sqfs ]; then
        touch $1/empty 2>/dev/null
        rm -f $1/empty 2>/dev/null
fi

find $1/modules/extras -name "*.sqfs" |  sort > $1/modules/extras/db.mod

sed -i "s|/bootmnt/modules/extras/||g" $1/modules/extras/db.mod

sed -i "s|.sqfs||g" $1/modules/extras/db.mod

I need help in getting from here on. It needs be able to find all modules in the list be a match in the pacman database and exit or it will move the older modules make a the newer update ones if in pacman database (/var/lib/pacman/sync). The modatabase script is meant for you to have the live cd on a usb drive or hard drive. This script will make it possable to have 100's of modules update at once when its competed.

Can anyone help me with this?

Last edited by godane (2008-10-05 05:32:37)


I'm working on a live cds based on Archlinux. http://godane.wordpress.com/

Offline

#2 2008-10-04 05:52:56

godane
Member
From: NH, USA
Registered: 2008-02-03
Posts: 241
Website

Re: Making a modular database for archiso-live (Competed)

#!/bin/bash

if [ -e /bootmnt/archlive.sqfs ]; then
        touch /bootmnt/empty 2>/dev/null
        rm -f /bootmnt/empty 2>/dev/null
fi

find /bootmnt/modules/extras -name "*.sqfs" | sort > /bootmnt/modules/extras/db.mod

sed -i "s|/bootmnt/modules/extras/||g" /bootmnt/modules/extras/db.mod

sed -i "s|.sqfs||g" /bootmnt/modules/extras/db.mod

sed -i "s|-i686||g" /bootmnt/modules/extras/db.mod

cp -f /bootmnt/modules/extras/db.mod /bootmnt/modules/extras/db.mod1
sed -i "s|-[0-9].*||g" /bootmnt/modules/extras/db.mod1

varwordline=$(wc -l /bootmnt/modules/extras/db.mod | sed "s| /bootmnt/modules/extras/db.mod||g")

PWD=$(pwd)
#sed -i "s|/bootmnt/modules/extras/db.mod||g" /bootmnt/modules/extras/db.mod1

for i in $varwordline; do
    find_pkgname1=$(head -n $i /bootmnt/modules/extras/db.mod)
    find_pkgname2=$(head -n $i /bootmnt/modules/extras/db.mod1)
    find /var/lib/pacman/sync -name $find_pkgname1 2>/dev/null
    
#    if [ $? -ne 0 ]; then
#    cd /bootmnt/modules/extras
#    mkdir -p /bootmnt/old
#    mv $find_pkgname1-i686.sqfs /bootmnt/old
#    arch2sqfs pkg $find_pkgname2
#    fi
done

This is version 2. Its better but i don't know how to make it copy older modules/packages if there is a newer one. The best i could think of is that if there is no match in the sync folder for the package then to build a new module.

Can anyone help me with this please? I want to make a fully modular live cd for archlinux. This script will make it possible to have 100's of modules updated at once.


I'm working on a live cds based on Archlinux. http://godane.wordpress.com/

Offline

#3 2008-10-04 23:34:13

ibendiben
Member
Registered: 2007-10-10
Posts: 519
Website

Re: Making a modular database for archiso-live (Competed)

Ideally the modules list should look a lot like:

pacman -Qe

If so, perhaps your can do something with:

pacman -Qeu

...to check which modules need to be updated.

I find it hard to understand your question though, so maybe I'm missing the point here.

Offline

#4 2008-10-05 05:26:34

godane
Member
From: NH, USA
Registered: 2008-02-03
Posts: 241
Website

Re: Making a modular database for archiso-live (Competed)

#!/bin/bash

if [ -e /bootmnt/archlive.sqfs ]; then
        touch /bootmnt/empty 2>/dev/null
        rm -f /bootmnt/empty 2>/dev/null
fi

find /bootmnt/modules/extras -name "*.sqfs" | sort > /bootmnt/modules/extras/db.mod

sed -i "s|/bootmnt/modules/extras/||g" /bootmnt/modules/extras/db.mod

sed -i "s|.sqfs||g" /bootmnt/modules/extras/db.mod

sed -i "s|-i686||g" /bootmnt/modules/extras/db.mod

#pacman -Qeu > /bootmnt/modules/extras/db.update

#cp -f /bootmnt/modules/extras/db.mod /bootmnt/modules/extras/db.mod1
#sed -i "s|-[0-9].*||g" /bootmnt/modules/extras/db.mod1

#varwordline=$(wc -l /bootmnt/modules/extras/db.mod | sed "s| /bootmnt/modules/extras/db.mod||g")

#PWD=$(pwd)

pkg()
{
    if [ "$1" != "" ]; then
    TMPDIR="$(pwd)/pkg2lzm$$"
    mkdir -p $TMPDIR/var/lib/pacman/local
    #sync
    
    #if [ $(whereis yaourt) ]; then
    pacman -Sw "$1" --noconfirm
    PKG=$(ls /var/cache/pacman/pkg/$1-[0-9]*.pkg.tar.gz)
    pacman -U -d -r $TMPDIR $PKG
    #else
    #pacman -Sw "$1" --noconfirm
    #pacman -U -d -r $TMPDIR $PKG
    #fi
    
    echo "Creating module ..."

    DESTINATION="$(pwd)/$(basename $PKG .pkg.tar.gz).sqfs"
    /sbin/mksquashfs $TMPDIR $DESTINATION -b 128kB > mksquashfs.log
    
    if [ $? -ne 0 ]; then 
    echo "Error building module"
    exit
    fi
    echo $DESTINATION
    chmod 0755 $DESTINATION
    fi
}

cat "/bootmnt/modules/extras/db.mod" | while read pkgname; do
if [ $pkgname != "" ]; then
    if [ ! $(find /var/lib/pacman/sync -name $pkgname) ]; then
    mkdir -p /bootmnt/old
    cd /bootmnt/modules/extras
    mv $pkgname* /bootmnt/old
    pkgname=$(echo $pkgname | sed "s|-[0-9].*||g")
    pkg $pkgname
    fi
fi
done

The script is compete and works well. The script moves older modules to the /bootmnt/old folder that is created. Then builds modules in /bootmnt/modules/extras folder. I think now we can have 100s of modules update without a problem.


I'm working on a live cds based on Archlinux. http://godane.wordpress.com/

Offline

Board footer

Powered by FluxBB