You are not logged in.
Pages: 1
hello guys i would liek to edit the mirrorlist file so if my local mirrorlist (usb device) is plugged it will use that mirror instead if will be unplugged to use the regular mirror
Server = file:///media/2ae73d8b-168b-4273-9df1-c10e83dc3dfe/repository/$repo/os/$arch
Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch
this is the two mirrors i have in my mirrorlist. if i run pacman -Syu without the local mirror plugged in i will get an error liek this:
error: failed retrieving file 'testing.db' from disk : No such file or directory
and then it will automatically jump at the second mirror. what i would liek to do is hide this errors if the device is not plugged in. i am guessing i need a script for this
#!/bin/bash
shopt -s nocaseglob
set -e
if [ ! -d "/media//2ae73d8b-168b-4273-9df1-c10e83dc3dfe/repository/" ]; then
echo "Using Local Mirror"
Server = file:///media/2ae73d8b-168b-4273-9df1-c10e83dc3dfe/repository/$repo/os/$arch
else
echo "Using External Mirror"
Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch
Server = http://mirror.rit.edu/archlinux/$repo/os/$arch
fi
ERROR:
# pacman -Syu
error: config file /etc/pacman.d/mirrorlist, line 2: directive 'shopt -s nocaseglob' in repository section 'testing' not recognized.
error: config file /etc/pacman.d/mirrorlist, line 2: directive 'shopt -s nocaseglob' in repository section 'core' not recognized.
error: config file /etc/pacman.d/mirrorlist, line 2: directive 'shopt -s nocaseglob' in repository section 'extra' not recognized.
error: config file /etc/pacman.d/mirrorlist, line 2: directive 'shopt -s nocaseglob' in repository section 'community' not recognized.
error: config file /etc/pacman.d/mirrorlist, line 2: directive 'shopt -s nocaseglob' in repository section 'multilib' not recognized.
:: Synchronizing package databases...
error: failed to update testing (no servers configured for repository)
error: failed to update core (no servers configured for repository)
error: failed to update extra (no servers configured for repository)
error: failed to update community (no servers configured for repository)
error: failed to update multilib (no servers configured for repository)
error: failed to synchronize any databases
Last edited by MystKid (2011-03-23 17:24:09)
Offline
18:23:37 Mion ╡ MystKid: btw, the mirrorlist is not a bash script
18:24:05 Mion ╡ MystKid: so you would have to wrap pacman and make your script change the mirrolist
edit: or keep 2 different pacman configs, and have your wrapper script tell pacman which to use by the --config flag.
18:34:06 Mion ╡ MystKid: if [ whatever]; then pacman --config /path/to/alternate/config "$@"; else pacman "$@", fi. ofcourse without the typos, wrong syntax etc
Last edited by Mr.Elendig (2011-03-23 17:37:22)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
i got it :
pac () {
if [ -d /media/2ae73d8b-168b-4273-9df1-c10e83dc3dfe/ ]; then
sudo pacman --config /home/arch/Scripts/pacman.conf "$@"
else
sudo pacman "$@"
fi
}
Last edited by MystKid (2011-03-23 20:13:30)
Offline
Pages: 1