You are not logged in.

#1 2011-11-06 16:39:30

aidaz
Member
Registered: 2011-10-28
Posts: 12

pacman recovery

im trying to do the instructions on arch wiki to recover pacman.
and i dont understad this bit:

Performing the recovery

As a normal user, make temporary directories for the cache, database, and root:
tmp=~/tmp
mkdir -p "${tmp}"

pushd "${tmp}"
dbpath=$(readlink -f ./dbpath)
root=$(readlink -f ./root)
cache=$(readlink -f ./cache)
log=/dev/null
mkdir -p "${dbpath}" "${cache}" "${root}"
popd

recovery-pacman() {
  fakeroot pacman "$@"   \
    --dbpath "${dbpath}" \
    --root   "${root}"   \
    --cache  "${cache}"  \
    --log    "${log}"    \
    --noscriptlet        \
    #
}

Populate the temporary sync database:
$ recovery-pacman -Sy

i take it i have to make a file for script, make it executable with
chmod -x file
./file
so i do that, but then when i try todo recovery-pacman -Sy
i get:
recovery-pacman -Sy
bash: recovery-pacman: command not found

what am i doing wrong?

Offline

#2 2011-11-06 16:51:50

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: pacman recovery

When pasting code, please use [ code ] tags https://bbs.archlinux.org/help.php#bbcode

like this

It makes the code more readable and more convenient to scroll through.


Is your script in $PATH? If not, you need to use the full path

/path/to/recovery-pacman -Sy

If the script is in your woking directory, do

./recovery-pacman -Sy

Last edited by karol (2011-11-06 16:55:38)

Offline

#3 2011-11-06 16:55:54

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: pacman recovery

As karol says.  Or, if you are in the directory of the script you can simply:

./recovery-pacman -Sy

#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#4 2011-11-06 17:06:46

aidaz
Member
Registered: 2011-10-28
Posts: 12

Re: pacman recovery

thanks for fast reply.
ive tried that as well and i get

[aidas@myhost ~]$ ./recovery-pacman -Sy
bash: ./recovery-pacman: No such file or directory

Offline

#5 2011-11-06 17:15:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: pacman recovery

Where do you have this file? Go to that directory and try again.

aidaz wrote:

i take it i have to make a file for script, make it executable with
chmod -x file
./file

'recovery-pacman' is the name of the function, what's the filename? You need to use the filename of the script.

Last edited by karol (2011-11-06 17:18:57)

Offline

#6 2011-11-07 13:36:23

aidaz
Member
Registered: 2011-10-28
Posts: 12

Re: pacman recovery

so say if the file name is script, i should run ./script -Sy?

Offline

#7 2011-11-07 13:41:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: pacman recovery

aidaz wrote:

so say if the file name is script, i should run ./script -Sy?

As for running the script is concerned, yes.
You can create

#!/bin/bash
echo foo

name it 'test1', make executable 'chmod +x test1' and run it with './test1' just to see if you get how to call a script.

Offline

#8 2011-11-07 21:58:34

aidaz
Member
Registered: 2011-10-28
Posts: 12

Re: pacman recovery

i can run that test1, it creates temporary folders. it just when i run test1 -Sy, i think it ment to populate temporary sync data, witch i think means it has to copy some stuff to them temporary folders that were created, but they all empty. so i presume i'm not getting something.
script in temp1:

tmp=~/tmp
mkdir -p "${tmp}"

pushd "${tmp}"
dbpath=$(readlink -f ./dbpath)
root=$(readlink -f ./root)
cache=$(readlink -f ./cache)
log=/dev/null
mkdir -p "${dbpath}" "${cache}" "${root}"
popd

recovery-pacman() {
  fakeroot pacman "$@"   \
    --dbpath "${dbpath}" \
    --root   "${root}"   \
    --cache  "${cache}"  \
    --log    "${log}"    \
    --noscriptlet        \
    #
} 

Offline

#9 2011-11-07 22:01:34

aidaz
Member
Registered: 2011-10-28
Posts: 12

Re: pacman recovery

and i understood how to run that script u posted before

#!/bin/bash
echo foo

result "foo" printed after execution.

Offline

Board footer

Powered by FluxBB