You are not logged in.

#1 2005-03-09 18:02:14

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Install scripts

hello,

I've written on my own library for pacmans api for a week now and i finally thought that I've implemented all things I wanted and started to install a few programs but now I suddenly realised that there is no support for installscripts and i have no idea how they works,

can somebody please explain how I should run them!
I found a function in the real pacman source but I didn't understand it,
here it how it looks in apeiros c version,

    vprint("Executing %s script...n", script);
    if(oldver) {
        snprintf(cmdline, PATH_MAX, "echo "umask 0022; source %s %s %s %s" | chroot %s /bin/sh",
                scriptpath, script, ver, oldver, pmo_root);
    } else {
        snprintf(cmdline, PATH_MAX, "echo "umask 0022; source %s %s %s" | chroot %s /bin/sh",
                scriptpath, script, ver, pmo_root);
    }
    vprint("%sn", cmdline);
    system(cmdline);

I don't understand a shit of those lines,


arch + gentoo + initng + python = enlisy

Offline

#2 2005-03-09 18:08:09

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Install scripts

snprintf puts the string into the variable.
the string is then echoed to the console, then the command is executed "system()".

the steps appear to be...
umask 0022
source srcriptpath script ver oldver
chroot pmo_root /bin/sh


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-03-09 18:18:13

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Install scripts

my head is going to explode soon,  big_smile
this must be explained line by line for me,

there are post_install(), post_upgrade() and pre_remove() in the scripts,
maybe I could get one example of how i should do,

as you say cactus it should look like this in python:

os.system("umask 0222")
os.system("source install, version | chroot /bin/sh ")

what should version be? exactly.


arch + gentoo + initng + python = enlisy

Offline

#4 2005-03-09 19:46:46

apeiro
Daddy
From: Victoria, BC, Canada
Registered: 2002-08-12
Posts: 771
Website

Re: Install scripts

The trick is that the umask and source steps must be done inside a pmo_root chroot.

So if you were to do this manually from the cmdline, it would look something like this:

old_root# chroot $pmo_root
pmo_root# umask 0022
pmo_root# source $scriptpath $script $ver $oldver

scriptpath:  the full path to the unpacked scriptlet file.  Pacman puts it somewhere like /tmp/pacman.A3E9F1B/.INSTALL
script: the scriptlet name to run (eg, post_install, pre_upgrade, etc)
ver:  the version being installed/upgraded to/removed
oldver: the version being upgraded from (sometimes n/a)

Offline

#5 2005-03-10 08:55:43

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Install scripts

thanks for the explanation apeiro but I still don't get the whole picture,
this is a little bit over my head,
here is PKGBUILDs for it so if any guys knows python and want to take a look at it maybe you can fix it,

pkgname=libpypac
pkgver=0.1
pkgrel=1
pkgdesc="A library implementing Pacmans API"
url=""
depends=("python")
provides=""
conflicts=""
source=("http://xerxes2.1go.dk/libpypac-0.1.tar.gz")
md5sums=("b6ba46bc777598639e6334e5e9bfc445")

build() {
  cd $startdir/src/$pkgname-$pkgver
  mkdir -p $startdir/pkg/usr/lib/python2.4/site-packages
  install -m 755 libpypac.py $startdir/pkg/usr/lib/python2.4/site-packages
 }

and here is a frontend for it, be careful with it and don't use it for installation if you don't feel lucky, ok! I've tried for lots of things but it's not always working, it works for small programs, could be something with installscripts,  big_smile

pkgname=lazy-pac
pkgver=0.1
pkgrel=1
pkgdesc="A GTK frontend for libpypac."
url=""
depends=("pygtk" "libpypac")
provides=""
conflicts=""
source=("http://xerxes2.1go.dk/lazy-pac-0.1.tar.gz")
md5sums=("815dd66074e5b773d593228179c17eae")

build() {
  cd $startdir/src/$pkgname-$pkgver
  mkdir -p $startdir/pkg/usr/bin
  mkdir -p $startdir/pkg/usr/share/lazy-pac
  mkdir -p $startdir/pkg/usr/lib/python2.4/site-packages/lazy_pac
  install -m 755 lazy-pac $startdir/pkg/usr/bin
  install -m 644 rc $startdir/pkg/usr/share/lazy-pac
  install -m 755 gtk_main.py $startdir/pkg/usr/lib/python2.4/site-packages/lazy_pac
  install -m 755 packageselect.py $startdir/pkg/usr/lib/python2.4/site-packages/lazy_pac
  install -m 755 __init__.py $startdir/pkg/usr/lib/python2.4/site-packages/lazy_pac
 }

i'm coding on a library for makepkg now, in Python of course, so if it works out we can have a complete WIMP driven build/install arch box,
this is of course only meant as a complement for the native C versions that will always be the cutting edge implementing all possible features and combinations of options,


arch + gentoo + initng + python = enlisy

Offline

Board footer

Powered by FluxBB