Arch linux support various server types?

Im new to linux and Arch is my first linux distro.
my question is does arch linux can be function as server ( like http, ftp, smtp, ssh, samba, etc)
and if so, where can i get guide(or instruction) to setting up the server?
(looked at Wiki tab but couldnt find one)
thank you

For a small server, I think arch will work fine.  It's rolling release system and lack of distro-specific patches can make it a little more difficult to maintain in my opinion, but as long as it's nothing production grade you'll be fine.
Arch is a good platform to learn linux since it really emphasizes doing everything by hand, you get to learn your system as you build it.  And your end product is only what you wanted, not what the distro maintainer envisioned you wanted.
Last edited by Aaron (2008-05-14 03:31:18)

Similar Messages

  • How many Physical CPUs Arch Linux Supports?

    How many Physical CPUs does Arch Linux Support, the traditional 2?
    Can it support 4 or more Physical CPUs, How?
    By Physical CPUs I take RedHat deffinition :
    Red Hat defines physical CPUs equivalently to sockets, so a multi-core and/or hyperthreading CPU is counted as a single CPU or socket when determining whichedition of Enterprise Linux to deploy.
    Thanks

    Let's put it this way.
    Linux can likely support more cpu's than you can afford.
    That is, unless you are super rich..
    If that is the case..then by all means.....
    ....donate!
    EDIT: After some peeking around.. I found this.
    SGI Altix 4700 incorporates the shared-memory NUMAflex™ architecture, which simplifies software development, workload management and system administration. It supports up to 512 processors under one instance of Linux and as much as 128TB of globally shared memory. Supporting these powerful capabilities is the NUMAlink™ interconnect, which leads the industry in bandwidth and latency for superior performance on cluster applications. The SGI Altix 4700 represents a versatile solution for shared or distributed memory applications of any scale.
    Likely SGI has a few tweaks that haven't percolated into the mainline kernel yet (pending or rejected)..But sgi usually pushes the high end mutiprocessor systems..
    So.. around 512?

  • Arch Linux as a server: advantages and disadvantages?

    Hello,
    I am about to create a hosting server for a great number of websites. Since i never actually did it myself it will be relatively new to me. For that reason I want to use Arch distro because I like it, understand it and have most experience with it.
    I wanted to hear opinions why Arch is suitable and why not for a server machine. Also, maybe someone could recommend other distros that are better fit for the job (provided there are any)
    Thanks!
    Last edited by Tsynique (2010-11-12 16:16:32)

    Short: CentOS is a pretty popular choice but I have no experience with it. You will need to make sure you have the latest security updates while also making sure that your keeping a good availability(up time), which could be a problem with Arch Linux.
    Long: Security updates and system up time/availability. Making sure you have the latest security updates may effect your server's availability. This can be a problem if you have paying clients as the updates may break stuff. Arch Linux doesn't have an official security team but there are some community efforts underway. Take a look at the wiki under security, firewalls and sysctl.conf hardening. Also keep your eye are ArchServer. I use Arch Linux on my VPS but its only been for hobby stuff so far. As I've been getting closer to relying on my website professionally I've been considering changing to a different dist. of Linux; the problem is I'm most familiar with Arch Linux, don't want to go back to Slackware and I'm not happy with the way Ubuntu does certain things[init system, sudo/root setup](I maintain an Ubuntu LAMP setup for our Intranet).

  • Video Tut: Arch Linux (x64) Dedicated Server Setup (vncserver, lxde)

    I was bored this evening so I decided to throw a small video tutorial together about this.
    https://www.youtube.com/watch?v=S-jcl9an3es
    Could this be useful for some people? Oh and if you guys have any constructive feedback to say about the video please tell me.
    And yeah I know, you shouldn't be using Arch if you need a video tutorial for installing it. It's meant to be a shortcut for people who already know most of their shit but can't be arsed to google around for a few commands and procedures they can't remember IF they can check them all from one package.
    Last edited by Harha (2014-04-27 21:51:07)

    Rexilion wrote:
    First 8 minutes and 50 seconds contain configuring the VM and installing Arch. Maybe seperate that?
    I cannot open your FTP from chromium. Filezilla works.
    I don't see any OpenSSH, VNC is very insecure to be exposed.
    Hmmh... Good points. I don't think the beginning of the video needs to be separated, but oh well, I could put a caption there which would indicate viewer to skip through the beginning if he wishes I guess...
    Anonymous FTP browsing Is working fine for me via browser? I even asked a few friends of mine to check and for both of them it worked in Chrome, Firefox and IE.
    And about OpenSSH, I should've really included that in the video, god damnit, how can I forget something as essential as that? I guess I'll have to make a part 2 for it plus a few other things when I find some free time again... And using VNC for a remote desktop experience is just something I prefer.
    Thanks for the feedback!
    Last edited by Harha (2014-04-28 11:17:46)

  • Arch Linux Support for Atmel ATmega168

    I'm thinking about buying this ATmega168: http://www.amazon.com/NerdKits-USB-Micr … B001I08PK8
    I'm wondering if the avrdude, binutils-avr, and gcc-avr packages (http://www.archlinux.org/packages/?q=avr) will work with it... Does anyone know?
    Last edited by tony5429 (2011-11-24 02:06:40)

    not only yes. but heck yes. I use D.) All of the above on every AVR micro I have (including the ATmega168).  sparkfun.com has a really good tutorial for getting started. I suggest it. (it is a windows tutorial, but the exact same software works the same on any PC.) One benefit of this tutorial is that it provides a fantastic skeleton makefile for all of your future AVR programming needs.
    oh yeah, and AVRFreaks.com is another really good resource.  I do quite a bit of work with AVR micro's. so if you ever have any specific questions feel free to PM me.

  • X server won't start (Arch Linux installed on USB key)

    Hi,
    I installed Arch Linux on a USB key (see the original thread: https://bbs.archlinux.org/viewtopic.php?id=185441).
    The problem is that X doesn't start on all machines.
    When starting the system on a machine with NVIDIA GTX 560Ti graphics card:
    - X doesn't start using startx or xinit and there are no log entries in /var/log/Xorg.*.log (as I haven't tried to start X).
    - I'm getting the message "Waiting for X server to begin accepting connections .. .. .. ..".
    - Additionally: The "default terminals tty1/2/3/..." (which I'm using to start X) from have a poor resolution (I think 640x480 pixel).
    When starting the system on a virtual machine or a machine with an ATI Radeon (mobile) graphics card:
    - X starts and runs without any trouble the XFCE desktop environment.
    - Additionally: The default terminals have a proper resolution (I think the maximal resolution of the display).
    What happens if you uninstall nvidia and use nouveau?
    I installed all video drivers recommended here: https://wiki.archlinux.org/index.php/In … eo_drivers
    So I was using nouveau in the first place. I already tried to uninstall the open source driver (xf86-video-nouveau, nouveau-dri) to use the default driver (I think this is xf86-video-vesa) with no effect.
    The poor tty resolution is to be expected if the closed-source nvidia drivers are installed, because they don't support KMS.
    I have never tried to install the proprietary driver (and actually don't want to use the proprietary driver).
    Also have you looked in /etc/X11 ?
    Yes. I don't think that my configuration contains anything preventing X from starting using the NVIDIA graphics card (but I'm not sure what to look for).
    I'm starting X using "startx" or "xinit -- :0 -nolisten tcp vt$XDG_VTNR". Here's my ~/.xinitrc:
    if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
    done
    unset f
    fi
    exec startxfce4
    Last edited by The Infinity (2014-08-14 21:17:41)

    I figured out where the problem comes from. It is actually the screen (which has a resolution of 1920x1080 pixel). When using a screen (with a smaller resolution) I'm getting a decent resolution in the terminal and - more imporant -  X starts and seems to use the Nouveau driver (which I have installed again). When plugging my normal screen again (while X is running) I'm able to use this screen with the maximum resolution without problems (so only starting with this screen does not work). Now I have a reference point to fix the problem.
    The other thread might be interesting as well.
    Last edited by The Infinity (2014-08-17 02:36:57)

  • Arch Linux 32x64 bits, Developers and Window Managers Support

    Greetings!
    After having some time issues due to college that prevented me from this, I wish to have again a rolling-release distro in my computer.
    I was in the past a big fan of Gentoo, but now it seems too much work to compile everything from scratch. Also they seemed to have some issues with the developers - the original developer if I understood correctly has quit the project, others were forced to quit due to misbehavior, etc. - and maybe due to some other facts their popularity on distrowatch dropped drastically.
    Then this year I've tried Debian Testing... My goodness, that was messy. Tons and tons of bugs on XFCE, like thunar hanging on load and displaying error messages, gedit not removing the ~lock files properly on close, so I had the myfile and ~myfile, and many others. Really, I gave up.
    I wish to give Arch Linux I try then. Of course that would be quite stupid to ask if arch linux is the best choice in an arch linux forum, but there are some key points that if you could answer would help me a lot to give it a try:
    1. 32x64
    "Should I use 32-bit or 64-bit?" is NOT the intended question. Many still prefer 32-bit-pae on a 64-bit capable machine, others prefer 64-bit. I wish to use 64-bit. Made my mind. But I would like to know if the support of 64-bit on Arch Linux is as good as 32-bit and if it comes by default with cross-libs which makes me able to run 32-bit applications natively right out of the box,
    2. Developers
    About how many and what's their relation with the users? When I've googled for Arch Linux, I've had found a review video on youtube where some guy said in the comments that developer's mind changed a lot in the past 2 years and they introduced many buggy packages that required manual workaround. At the end of his comments, he said "Sympathy? Apologies for the ****? Nope. blame the user for trusting 'pacman -Syu'" Surely I don't know which are these options because I haven't read about pacman yet (just know it's the default package manager) but you get the idea.
    Another key question: Is Arch Linux hiring new developers over the time? Replacing the ones that leaves for the many reasons?
    3. Window Managers Support
    With Gnome3's overall rejection (including mine), we have only two options: Switch to KDE or try other Window Managers. I still wish to have faith on gtk, so the first option is still not considered by me. I don't wish to know "which one is the best", because that's another large discussion just as the 32-bit x 64-bit. Just how good is Arch's support (updated constantly? bug-fixes?) on:
    - XFCE
    - MATE
    - Cinnamon
    (Of course there are others like LXDE, Enlightenment, etc. but I've decided to narrow down to XFCE even having quite bad experiences on Debian Testing.)
    4. Package Manager
    Last, being a rolling-release dist, can I add an option for a specific package to install a specific older version and/or not upgrade when you tell the dist. to upgrade everything? I remember that back on Gentoo I could edit a text file and just type the version of the package I wished to keep and the "update everything" option wouldn't touch the package (worked also to try new versions that were still not stable enough).
    Any replies will be very appreciated. Sorry for the long post.
    Best regards.

    I'll start at the end with #4.  Of course on the arch forums you will get people who are biased towards liking arch - but I think if you ask in other communities you will regularly hear that arch's package management system is its greatest strength.  Pacman is the primary tool for this, but we also have makepkg for things in the Arch User Repository (AUR), and the Arch Build System (ABS) to recompile anything from the main repos with additional/alternate compilation options.
    But for your direct question, there is an option to only upgrade to a particular version of a given package.  There is an option in pacman's configuration file for just this purpose.  However depending on what the package is, this could lead to problems.  Users are discouraged from updating most of their system while keeping some older packages - This can lead to issues with shared dependencies.  Of course if you build the package from source (AUR or ABS) yourself, such issues would be easy to resolve.  Is there a certain package you know you'd want to keep at an older version?  If you tell us what it is, we can give more specific information on how easy/hard it would be to accomplish.
    #3: Arch is a DIY distro.  You choose whatever window manager / DE you want.  I can vouche for XFCE working wonderfully in arch.  There are also numerous archers who use mate and cinnamon.  I have heard of some problems, but (AFAIK) these have nothing to do with compatibility with arch, rather these are due to upstream issues.  In other words, cinnamon, mate, xfce, or any other WM should work just as well on arch as on any other distro.  I'd bet our wiki for installing and configuring those WMs are better than those of the distros that bundle the WM with the core install.  (In addition to package management, you will find the arch wiki is second to none).
    #2: I can't answer with any specifics - other than to say they continue to do an excellent job.  I am not surprised by the youtube video - not because I'd agree with it, quite the opposite.  But as arch is a DIY distro it puts some responsibility on the user to maintain their own system.  If one is not prepared for nor willing to do this, they often become frustrated and end up blaming someone else.  Often this is the developers, sometimes it is the forum moderators, other times it is the whole arch community.  In every case these accusations are absurd.  Your questions on replacement of developers is a good question though - there is a history page on the wiki which might give some insight on this, but I suspect others will have better input on this.
    #1: I use i686 (32bit) on two of my computers and it works perfectly.  It sounds, however, that a majority of the community uses 64bit (which I just updated to on one of my computers).  My 64bit system works perfectly as well, but I don't have any 32bit-only apps.  Occasionally there are forum threads about some issue or another with "multilib" applications which are 32bit programs run in a 64bit system.  Generally these threads seem to be resolved without much hassle.  You can search for some of them yourself: Skype seems to be a common topic of such issues.
    All in all, I'd reiterate arch's strengths in it's package management and wiki/documentation.  Potential weaknesses could be found by users who are unwilling or unable to take responsibility for their own system.  I word this is a bit biased manner - there are many people who have no interest in being responsible for maintaining their own system, a majority of all computer users would fall into this category; most of them would be quite unhappy with arch linux.  If you were happy with gentoo in the past and only want to avoid constant recompiling then you probably would be one who could be very happy with arch.
    Or an even shorter summary: try it out.  If you don't like it, switch.

  • This Database Server Type is not supported

    Dear Experts,
    Kindly suggest your opinion regarding this issue we had freshly installed a SAP 2007B in our Server Edition is Microsoft  Windows 2003 and Database is of MSSql_2005 R2 Standard Edition and we had upgraded the SAP 2007B to PL_18.
    Now when we login to DTW on Change server for SQL Connection getting an error of "This Database Server Type is not Supported." 
    So any body had a solution or faced this kind of issue please share your knowledge to out come from this issue..
    Thanks in Advance...
    Regards
    Krishnakumar

    Hi Krishna,
    check out the following link
    http://scn.sap.com/message/14683740#14683740
    Regards,
    Iván Fernando V.

  • Emacs compiled with S/MIME support in Arch Linux

    I have been trying without success to get Emacs 23.2 and Gnus 5.13 in Arch Linux to generate messages signed with S/MIME certificates, which are frequently used by the U.S. government and by businesses.  My configuration works fine on my Ubuntu workstation (as opposed to my Arch Linux laptop).  The error I usually get is "smime-sign-buffer is void."  I am beginning to wonder whether Emacs/Gnus on Arch is compiled with S/MIME support.  Does anyone happen to know, or has anyone had any success getting signatures with S/MIME to work on Arch?
    Thanks,
    Bill Day

    I can't help you with emacs, but to find out what options the packages in the repos are compiled with you want abs. With abs you can then use the same PKGBUILD that was used to make the official packages, and change only what you need to change, as opposed to starting from scratch when compiling.
    A few useful links:
    http://wiki.archlinux.org/index.php/Creating_Packages
    http://wiki.archlinux.org/index.php/Makepkg

  • 119 Database server type not supported ???help (using VC++)

    Hello Every one~
    I am using VC++
    Code:   oCompany->Putlanguage((SAPbobsCOM::BoSuppLangs)4);
    Go Compile  
    Error is "-119 Database server type not supported"
    MSSQL  version is SQL SERVER 2005
    help!!

    Welcome you to the forum.
    Please response or close your first question.
    Have you searched the forum. You may check this first: Database server type not supported & Failed to connect to SBOCommon
    Thanks,
    Gordon

  • Setting up an Arch Linux server

    I apologize if this is in the wrong topic. Anyways I am vary new to arch linux and linux in general, and I need to set up a server to host a website. It will be fairly small with low traffic.
    I followed the guide on the wiki to install and configure LAMP, but after that I have no idea what to do. I was looking for someone to at least point me in the right direction.
    I should also note the website I want to host is already created.
    Last edited by zanandan (2013-07-17 15:51:07)

    Woah woah, I'm sure lighttpd is a fine piece of software, but it sounds like zanandan already has his server completely setup.
    zanandan wrote:How do I set it up to be a normal www. webpage?
    What URL did you purchase or sign up to use? If you don't have one, you will need to get one from a domain name registrar.
    You then tell the registrar to point your new "zanandan.com" website to point to the IP address that is given to your router from your Internet service provider (see http://www.whatismyip.com/). You then configure your router to send all HTTP traffic (port 80) directly to the IP address for your server (it probably looks like 192.168.###.###). You now have a website accessible from anywhere.
    Be warned, though: Many Internet service providers send a new random IP address to your router every few days, so I have a service ("ddclient") that automatically updates my URL with my new IP address every so often.
    I use http://dyn.com/dns/ for my free domain name.

  • Arch Linux Server Problem

    Hello everyone,
    Alright, so I have Arch Linux installed on my Toshiba laptop. I wanted to test using a Linux box as a Minecraft Server. I have everything setup correctly. After I run the shell script to launch the server, everything seems to load fine, just like it did in Win 7 (I have Arch and Win 7 dual-booted). After I go to join the server on the host PC, and a different one, it hangs on 'Connecting to server'. Now, in Windows, it will log right into the server, on port 25565. On Arch, it hangs on 'Connecting to server'. I was wondering if Arch Linux blocks ports by default. This is probably a stupid question, hence the category, but Google couldn't help me this time. By the way, here is the guide I followed to setup my server: 
    http://wiki.bukkit.org/Setting_up_a_server#Linux .
    I know I have my ports forwarded. Any suggestions? Thanks in advance.

    Does anything interesting appear in the Minecraft server's output? I am running a Minecraft server just fine and it was literally just a case of downloading the jar, making a server.properties file, and running the jar. No extra configuration was done.

  • System encryption using LUKS and GPG encrypted keys for arch linux

    Update: As of 2012-03-28, arch changed from gnupg 1.4 to 2.x which uses pinentry for the password dialog. The "etwo" hook described here doesn't work with gnupg 2. Either use the openssl hook below or use a statically compiled version of gnupg 1.4.
    Update: As of 2012-12-19, the mkinitcpio is not called during boot, unless the "install" file for the hook contains "add_runscript". This resulted in an unbootable system for me. Also, the method name was changed from install () to build ().
    Update: 2013-01-13: Updated the hook files using the corrections by Deth.
    Note: This guide is a bit dated now, in particular the arch installation might be different now. But essentially, the approach stays the same. Please also take a look at the posts further down, specifically the alternative hooks that use openssl.
    I always wanted to set up a fully encrypted arch linux server that uses gpg encrypted keyfiles on an external usb stick and luks for root filesystem encryption. I already did it once in gentoo using this guide. For arch, I had to play alot with initcpio hooks and after one day of experimentation, I finally got it working. I wrote a little guide for myself which I'm going to share here for anyone that might be interested. There might be better or easier ways, like I said this is just how I did it. I hope it might help someone else. Constructive feedback is always welcome
    Intro
    Using arch linux mkinitcpio's encrypt hook, one can easily use encrypted root partitions with LUKS. It's also possible to use key files stored on an external drive, like an usb stick. However, if someone steals your usb stick, he can just copy the key and potentially access the system. I wanted to have a little extra security by additionally encrypting the key file with gpg using a symmetric cipher and a passphrase.
    Since the encrypt hook doesn't support this scenario, I created a modifed hook called “etwo” (silly name I know, it was the first thing that came to my mind). It will simply look if the key file has the extension .gpg and, if yes, use gpg to decrypt it, then pipe the result into cryptsetup.
    Conventions
    In this short guide, I use the following disk/partition names:
    /dev/sda: is the hard disk that will contain an encrypted swap (/dev/sda1), /var (/dev/sda2) and root (/dev/sda3) partition.
    /dev/sdb is the usb stick that will contain the gpg encrypted luks keys, the kernel and grub. It will have one partition /dev/sdb1 formatted with ext2.
    /dev/mapper/root, /dev/mapper/swap and /dev/mapper/var will be the encrypted devices.
    Credits
    Thanks to the authors of SECURITY_System_Encryption_DM-Crypt_with_LUKS (gentoo wiki), System Encryption with LUKS (arch wiki), mkinitcpio (arch wiki) and Early Userspace in Arch Linux (/dev/brain0 blog)!
    Guide
    1. Boot the arch live cd
    I had to use a newer testing version, because the 2010.05 cd came with a broken gpg. You can download one here: http://releng.archlinux.org/isos/. I chose the “core“ version. Go ahead and boot the live cd, but don't start the setup yet.
    2. Set keymap
    Use km to set your keymap. This is important for non-qwerty keyboards to avoid suprises with passphrases...
    3. Wipe your discs
    ATTENTION: this will DELETE everything on /dev/sda and /dev/sdb forever! Do not blame me for any lost data!
    Before encrypting the hard disc, it has to be completely wiped and overwritten with random data. I used shred for this. Others use badblocks or dd with /dev/urandom. Either way, this will take a long time, depending on the size of your disc. I also wiped my usb stick just to be sure.
    shred -v /dev/sda
    shred -v /dev/sdb
    4. Partitioning
    Fire up fdisk and create the following partitions:
    /dev/sda1, type linux swap.
    /dev/sda2: type linux
    /dev/sda3: type linux
    /dev/sdb1, type linux
    Of course you can choose a different layout, this is just how I did it. Keep in mind that only the root filesystem will be decrypted by the initcpio. The rest will be decypted during normal init boot using /etc/crypttab, the keys being somewhere on the root filesystem.
    5. Format  and mount the usb stick
    Create an ext2 filesystem on /dev/sdb1:
    mkfs.ext2 /dev/sdb1
    mkdir /root/usb
    mount /dev/sdb1 /root/usb
    cd /root/usb # this will be our working directory for now.
    Do not mount anything to /mnt, because the arch installer will use that directory later to mount the encrypted root filesystem.
    6. Configure the network (if not already done automatically)
    ifconfig eth0 192.168.0.2 netmask 255.255.255.0
    route add default gw 192.168.0.1
    echo "nameserver 192.168.0.1" >> /etc/resolv.conf
    (this is just an example, your mileage may vary)
    7. Install gnupg
    pacman -Sy
    pacman -S gnupg
    Verify that gnupg works by launching gpg.
    8. Create the keys
    Just to be sure, make sure swap is off:
    cat /proc/swaps
    should return no entries.
    Create gpg encrypted keys (remember, we're still in our working dir /root/usb):
    dd if=/dev/urandom bs=512 count=4 | gpg -v --cipher-algo aes256 --digest-algo sha512 -c -a > root.gpg
    dd if=/dev/urandom bs=512 count=4 | gpg -v --cipher-algo aes256 --digest-algo sha512 -c -a > var.gpg
    Choose a strong password!!
    Don't do this in two steps, e.g don't do dd to a file and then gpg on that file. The key should never be stored in plain text on an unencrypted device, except if that device is wiped on system restart (ramfs)!
    Note that the default cipher for gpg is cast5, I just chose to use a different one.
    9. Create the encrypted devices with cryptsetup
    Create encrypted swap:
    cryptsetup -c aes-cbc-essiv:sha256 -s 256 -h whirlpool -d /dev/urandom create swap /dev/sda1
    You should see /dev/mapper/swap now. Don't format nor turn it on for now. This will be done by the arch installer.
    Important: From the Cryptsetup 1.1.2 Release notes:
    Cryptsetup can accept passphrase on stdin (standard input). Handling of new line (\n) character is defined by input specification:
        if keyfile is specified as "-" (using --key-file=- or by positional argument in luksFormat and luksAddKey, like cat file | cryptsetup --key-file=- <action> ), input is processed
          as normal binary file and no new line is interpreted.
        if there is no key file specification (with default input from stdin pipe like echo passphrase | cryptsetup <action> ) input is processed as input from terminal, reading will
          stop after new line is detected.
    If I understand this correctly, since the randomly generated key can contain a newline early on, piping the key into cryptsetup without specifying --key-file=- could result in a big part of the key to be ignored by cryptsetup. Example: if the random key was "foo\nandsomemorebaratheendofthekey", piping it directly into cryptsetup without --key-file=- would result in cryptsetup using only "foo" as key which would have big security implications. We should therefor ALWAYS pipe the key into cryptsetup using --key-file=- which ignores newlines.
    gpg -q -d root.gpg 2>/dev/null | cryptsetup -v -–key-file=- -c aes-cbc-essiv:sha256 -s 256 -h whirlpool luksFormat /dev/sda3
    gpg -q -d var.gpg 2>/dev/null | cryptsetup -v –-key-file=- -c aes-cbc-essiv:sha256 -s 256 -h whirlpool -v luksFormat /dev/sda2
    Check for any errors.
    10. Open the luks devices
    gpg -d root.gpg 2>/dev/null | cryptsetup -v –-key-file=- luksOpen /dev/sda3 root
    gpg -d var.gpg 2>/dev/null | cryptsetup -v –-key-file=- luksOpen /dev/sda2 var
    If you see /dev/mapper/root and /dev/mapper/var now, everything is ok.
    11. Start the installer /arch/setup
    Follow steps 1 to 3.
    At step 4 (Prepare hard drive(s), select “3 – Manually Configure block devices, filesystems and mountpoints. Choose /dev/sdb1 (the usb stick) as /boot, /dev/mapper/swap for swap, /dev/mapper/root for / and /dev/mapper/var for /var.
    Format all drives (choose “yes” when asked “do you want to have this filesystem (re)created”) EXCEPT for /dev/sdb1, choose “no”. Choose the correct filesystem for /dev/sdb1, ext2 in my case. Use swap for /dev/mapper/swap. For the rest, I chose ext4.
    Select DONE to start formatting.
    At step 5 (Select packages), select grub as boot loader. Select the base group. Add mkinitcpio.
    Start step 6 (Install packages).
    Go to step 7 (Configure System).
    By sure to set the correct KEYMAP, LOCALE and TIMEZONE in /etc/rc.conf.
    Edit /etc/fstab:
    /dev/mapper/root / ext4 defaults 0 1
    /dev/mapper/swap swap swap defaults 0 0
    /dev/mapper/var /var ext4 defaults 0 1
    # /dev/sdb1 /boot ext2 defaults 0 1
    Configure the rest normally. When you're done, setup will launch mkinitcpio. We'll manually launch this again later.
    Go to step 8 (install boot loader).
    Be sure to change the kernel line in menu.lst:
    kernel /vmlinuz26 root=/dev/mapper/root cryptdevice=/dev/sda3:root cryptkey=/dev/sdb1:ext2:/root.gpg
    Don't forget the :root suffix in cryptdevice!
    Also, my root line was set to (hd1,0). Had to change that to
    root (hd0,0)
    Install grub to /dev/sdb (the usb stick).
    Now, we can exit the installer.
    12. Install mkinitcpio with the etwo hook.
    Create /mnt/lib/initcpio/hooks/etwo:
    #!/usr/bin/ash
    run_hook() {
    /sbin/modprobe -a -q dm-crypt >/dev/null 2>&1
    if [ -e "/sys/class/misc/device-mapper" ]; then
    if [ ! -e "/dev/mapper/control" ]; then
    /bin/mknod "/dev/mapper/control" c $(cat /sys/class/misc/device-mapper/dev | sed 's|:| |')
    fi
    [ "${quiet}" = "y" ] && CSQUIET=">/dev/null"
    # Get keyfile if specified
    ckeyfile="/crypto_keyfile"
    usegpg="n"
    if [ "x${cryptkey}" != "x" ]; then
    ckdev="$(echo "${cryptkey}" | cut -d: -f1)"
    ckarg1="$(echo "${cryptkey}" | cut -d: -f2)"
    ckarg2="$(echo "${cryptkey}" | cut -d: -f3)"
    if poll_device "${ckdev}" ${rootdelay}; then
    case ${ckarg1} in
    *[!0-9]*)
    # Use a file on the device
    # ckarg1 is not numeric: ckarg1=filesystem, ckarg2=path
    if [ "${ckarg2#*.}" = "gpg" ]; then
    ckeyfile="${ckeyfile}.gpg"
    usegpg="y"
    fi
    mkdir /ckey
    mount -r -t ${ckarg1} ${ckdev} /ckey
    dd if=/ckey/${ckarg2} of=${ckeyfile} >/dev/null 2>&1
    umount /ckey
    # Read raw data from the block device
    # ckarg1 is numeric: ckarg1=offset, ckarg2=length
    dd if=${ckdev} of=${ckeyfile} bs=1 skip=${ckarg1} count=${ckarg2} >/dev/null 2>&1
    esac
    fi
    [ ! -f ${ckeyfile} ] && echo "Keyfile could not be opened. Reverting to passphrase."
    fi
    if [ -n "${cryptdevice}" ]; then
    DEPRECATED_CRYPT=0
    cryptdev="$(echo "${cryptdevice}" | cut -d: -f1)"
    cryptname="$(echo "${cryptdevice}" | cut -d: -f2)"
    else
    DEPRECATED_CRYPT=1
    cryptdev="${root}"
    cryptname="root"
    fi
    warn_deprecated() {
    echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
    echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
    if poll_device "${cryptdev}" ${rootdelay}; then
    if /sbin/cryptsetup isLuks ${cryptdev} >/dev/null 2>&1; then
    [ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
    dopassphrase=1
    # If keyfile exists, try to use that
    if [ -f ${ckeyfile} ]; then
    if [ "${usegpg}" = "y" ]; then
    # gpg tty fixup
    if [ -e /dev/tty ]; then mv /dev/tty /dev/tty.backup; fi
    cp -a /dev/console /dev/tty
    while [ ! -e /dev/mapper/${cryptname} ];
    do
    sleep 2
    /usr/bin/gpg -d "${ckeyfile}" 2>/dev/null | cryptsetup --key-file=- luksOpen ${cryptdev} ${cryptname} ${CSQUIET}
    dopassphrase=0
    done
    rm /dev/tty
    if [ -e /dev/tty.backup ]; then mv /dev/tty.backup /dev/tty; fi
    else
    if eval /sbin/cryptsetup --key-file ${ckeyfile} luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; then
    dopassphrase=0
    else
    echo "Invalid keyfile. Reverting to passphrase."
    fi
    fi
    fi
    # Ask for a passphrase
    if [ ${dopassphrase} -gt 0 ]; then
    echo ""
    echo "A password is required to access the ${cryptname} volume:"
    #loop until we get a real password
    while ! eval /sbin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; do
    sleep 2;
    done
    fi
    if [ -e "/dev/mapper/${cryptname}" ]; then
    if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
    export root="/dev/mapper/root"
    fi
    else
    err "Password succeeded, but ${cryptname} creation failed, aborting..."
    exit 1
    fi
    elif [ -n "${crypto}" ]; then
    [ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
    msg "Non-LUKS encrypted device found..."
    if [ $# -ne 5 ]; then
    err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
    err "Non-LUKS decryption not attempted..."
    return 1
    fi
    exe="/sbin/cryptsetup create ${cryptname} ${cryptdev}"
    tmp=$(echo "${crypto}" | cut -d: -f1)
    [ -n "${tmp}" ] && exe="${exe} --hash \"${tmp}\""
    tmp=$(echo "${crypto}" | cut -d: -f2)
    [ -n "${tmp}" ] && exe="${exe} --cipher \"${tmp}\""
    tmp=$(echo "${crypto}" | cut -d: -f3)
    [ -n "${tmp}" ] && exe="${exe} --key-size \"${tmp}\""
    tmp=$(echo "${crypto}" | cut -d: -f4)
    [ -n "${tmp}" ] && exe="${exe} --offset \"${tmp}\""
    tmp=$(echo "${crypto}" | cut -d: -f5)
    [ -n "${tmp}" ] && exe="${exe} --skip \"${tmp}\""
    if [ -f ${ckeyfile} ]; then
    exe="${exe} --key-file ${ckeyfile}"
    else
    exe="${exe} --verify-passphrase"
    echo ""
    echo "A password is required to access the ${cryptname} volume:"
    fi
    eval "${exe} ${CSQUIET}"
    if [ $? -ne 0 ]; then
    err "Non-LUKS device decryption failed. verify format: "
    err " crypto=hash:cipher:keysize:offset:skip"
    exit 1
    fi
    if [ -e "/dev/mapper/${cryptname}" ]; then
    if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
    export root="/dev/mapper/root"
    fi
    else
    err "Password succeeded, but ${cryptname} creation failed, aborting..."
    exit 1
    fi
    else
    err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
    fi
    fi
    rm -f ${ckeyfile}
    fi
    Create /mnt/lib/initcpio/install/etwo:
    #!/bin/bash
    build() {
    local mod
    add_module dm-crypt
    if [[ $CRYPTO_MODULES ]]; then
    for mod in $CRYPTO_MODULES; do
    add_module "$mod"
    done
    else
    add_all_modules '/crypto/'
    fi
    add_dir "/dev/mapper"
    add_binary "cryptsetup"
    add_binary "dmsetup"
    add_binary "/usr/bin/gpg"
    add_file "/usr/lib/udev/rules.d/10-dm.rules"
    add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
    add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
    add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
    add_runscript
    help ()
    cat<<HELPEOF
    This hook allows for an encrypted root device with support for gpg encrypted key files.
    To use gpg, the key file must have the extension .gpg and you have to install gpg and add /usr/bin/gpg
    to your BINARIES var in /etc/mkinitcpio.conf.
    HELPEOF
    Edit /mnt/etc/mkinitcpio.conf (only relevant sections displayed):
    MODULES=”ext2 ext4” # not sure if this is really nessecary.
    BINARIES=”/usr/bin/gpg” # this could probably be done in install/etwo...
    HOOKS=”base udev usbinput keymap autodetect pata scsi sata usb etwo filesystems” # (usbinput is only needed if you have an usb keyboard)
    Copy the initcpio stuff over to the live cd:
    cp /mnt/lib/initcpio/hooks/etwo /lib/initcpio/hooks/
    cp /mnt/lib/initcpio/install/etwo /lib/initcpio/install/
    cp /mnt/etc/mkinitcpio.conf /etc/
    Verify your LOCALE, KEYMAP and TIMEZONE in /etc/rc.conf!
    Now reinstall the initcpio:
    mkinitcpio -g /mnt/boot/kernel26.img
    Make sure there were no errors and that all hooks were included.
    13. Decrypt the "var" key to the encrypted root
    mkdir /mnt/keys
    chmod 500 /mnt/keys
    gpg –output /mnt/keys/var -d /mnt/boot/var.gpg
    chmod 400 /mnt/keys/var
    14. Setup crypttab
    Edit /mnt/etc/crypttab:
    swap /dev/sda1 SWAP -c aes-cbc-essiv:sha256 -s 256 -h whirlpool
    var /dev/sda2 /keys/var
    15. Reboot
    We're done, you may reboot. Make sure you select the usb stick as the boot device in your bios and hope for the best. . If it didn't work, play with grub's settings or boot from the live cd, mount your encrypted devices and check all settings. You might also have less trouble by using uuid's instead of device names.  I chose device names to keep things as simple as possible, even though it's not the optimal way to do it.
    Make backups of your data and your usb stick and do not forget your password(s)! Or you can say goodbye to your data forever...
    Last edited by fabriceb (2013-01-15 22:36:23)

    I'm trying to run my install script that is based on https://bbs.archlinux.org/viewtopic.php?id=129885
    Decrypting the gpg key after grub works, but then "Devce root already exists." appears every second.
    any idea ?
    #!/bin/bash
    # This script is designed to be run in conjunction with a UEFI boot using Archboot intall media.
    # prereqs:
    # EFI "BIOS" set to boot *only* from EFI
    # successful EFI boot of Archboot USB
    # mount /dev/sdb1 /src
    set -o nounset
    #set -o errexit
    # Host specific configuration
    # this whole script needs to be customized, particularly disk partitions
    # and configuration, but this section contains global variables that
    # are used during the system configuration phase for convenience
    HOSTNAME=daniel
    USERNAME=user
    # Globals
    # We don't need to set these here but they are used repeatedly throughout
    # so it makes sense to reuse them and allow an easy, one-time change if we
    # need to alter values such as the install target mount point.
    INSTALL_TARGET="/install"
    HR="--------------------------------------------------------------------------------"
    PACMAN="pacman --noconfirm --config /tmp/pacman.conf"
    TARGET_PACMAN="pacman --noconfirm --config /tmp/pacman.conf -r ${INSTALL_TARGET}"
    CHROOT_PACMAN="pacman --noconfirm --cachedir /var/cache/pacman/pkg --config /tmp/pacman.conf -r ${INSTALL_TARGET}"
    FILE_URL="file:///packages/core-$(uname -m)/pkg"
    FTP_URL='ftp://mirrors.kernel.org/archlinux/$repo/os/$arch'
    HTTP_URL='http://mirrors.kernel.org/archlinux/$repo/os/$arch'
    # Functions
    # I've avoided using functions in this script as they aren't required and
    # I think it's more of a learning tool if you see the step-by-step
    # procedures even with minor duplciations along the way, but I feel that
    # these functions clarify the particular steps of setting values in config
    # files.
    SetValue () {
    # EXAMPLE: SetValue VARIABLENAME '\"Quoted Value\"' /file/path
    VALUENAME="$1" NEWVALUE="$2" FILEPATH="$3"
    sed -i "s+^#\?\(${VALUENAME}\)=.*$+\1=${NEWVALUE}+" "${FILEPATH}"
    CommentOutValue () {
    VALUENAME="$1" FILEPATH="$2"
    sed -i "s/^\(${VALUENAME}.*\)$/#\1/" "${FILEPATH}"
    UncommentValue () {
    VALUENAME="$1" FILEPATH="$2"
    sed -i "s/^#\(${VALUENAME}.*\)$/\1/" "${FILEPATH}"
    # Initialize
    # Warn the user about impending doom, set up the network on eth0, mount
    # the squashfs images (Archboot does this normally, we're just filling in
    # the gaps resulting from the fact that we're doing a simple scripted
    # install). We also create a temporary pacman.conf that looks for packages
    # locally first before sourcing them from the network. It would be better
    # to do either *all* local or *all* network but we can't for two reasons.
    # 1. The Archboot installation image might have an out of date kernel
    # (currently the case) which results in problems when chrooting
    # into the install mount point to modprobe efivars. So we use the
    # package snapshot on the Archboot media to ensure our kernel is
    # the same as the one we booted with.
    # 2. Ideally we'd source all local then, but some critical items,
    # notably grub2-efi variants, aren't yet on the Archboot media.
    # Warn
    timer=9
    echo -e "\n\nMAC WARNING: This script is not designed for APPLE MAC installs and will potentially misconfigure boot to your existing OS X installation. STOP NOW IF YOU ARE ON A MAC.\n\n"
    echo -n "GENERAL WARNING: This procedure will completely format /dev/sda. Please cancel with ctrl-c to cancel within $timer seconds..."
    while [[ $timer -gt 0 ]]
    do
    sleep 1
    let timer-=1
    echo -en "$timer seconds..."
    done
    echo "STARTING"
    # Get Network
    echo -n "Waiting for network address.."
    #dhclient eth0
    dhcpcd -p eth0
    echo -n "Network address acquired."
    # Mount packages squashfs images
    umount "/packages/core-$(uname -m)"
    umount "/packages/core-any"
    rm -rf "/packages/core-$(uname -m)"
    rm -rf "/packages/core-any"
    mkdir -p "/packages/core-$(uname -m)"
    mkdir -p "/packages/core-any"
    modprobe -q loop
    modprobe -q squashfs
    mount -o ro,loop -t squashfs "/src/packages/archboot_packages_$(uname -m).squashfs" "/packages/core-$(uname -m)"
    mount -o ro,loop -t squashfs "/src/packages/archboot_packages_any.squashfs" "/packages/core-any"
    # Create temporary pacman.conf file
    cat << PACMANEOF > /tmp/pacman.conf
    [options]
    Architecture = auto
    CacheDir = ${INSTALL_TARGET}/var/cache/pacman/pkg
    CacheDir = /packages/core-$(uname -m)/pkg
    CacheDir = /packages/core-any/pkg
    [core]
    Server = ${FILE_URL}
    Server = ${FTP_URL}
    Server = ${HTTP_URL}
    [extra]
    Server = ${FILE_URL}
    Server = ${FTP_URL}
    Server = ${HTTP_URL}
    #Uncomment to enable pacman -Sy yaourt
    [archlinuxfr]
    Server = http://repo.archlinux.fr/\$arch
    PACMANEOF
    # Prepare pacman
    [[ ! -d "${INSTALL_TARGET}/var/cache/pacman/pkg" ]] && mkdir -m 755 -p "${INSTALL_TARGET}/var/cache/pacman/pkg"
    [[ ! -d "${INSTALL_TARGET}/var/lib/pacman" ]] && mkdir -m 755 -p "${INSTALL_TARGET}/var/lib/pacman"
    ${PACMAN} -Sy
    ${TARGET_PACMAN} -Sy
    # Install prereqs from network (not on archboot media)
    echo -e "\nInstalling prereqs...\n$HR"
    #sed -i "s/^#S/S/" /etc/pacman.d/mirrorlist # Uncomment all Server lines
    UncommentValue S /etc/pacman.d/mirrorlist # Uncomment all Server lines
    ${PACMAN} --noconfirm -Sy gptfdisk btrfs-progs-unstable libusb-compat gnupg
    # Configure Host
    # Here we create three partitions:
    # 1. efi and /boot (one partition does double duty)
    # 2. swap
    # 3. our encrypted root
    # Note that all of these are on a GUID partition table scheme. This proves
    # to be quite clean and simple since we're not doing anything with MBR
    # boot partitions and the like.
    echo -e "format\n"
    # shred -v /dev/sda
    # disk prep
    sgdisk -Z /dev/sda # zap all on disk
    #sgdisk -Z /dev/mmcb1k0 # zap all on sdcard
    sgdisk -a 2048 -o /dev/sda # new gpt disk 2048 alignment
    #sgdisk -a 2048 -o /dev/mmcb1k0
    # create partitions
    sgdisk -n 1:0:+200M /dev/sda # partition 1 (UEFI BOOT), default start block, 200MB
    sgdisk -n 2:0:+4G /dev/sda # partition 2 (SWAP), default start block, 200MB
    sgdisk -n 3:0:0 /dev/sda # partition 3, (LUKS), default start, remaining space
    #sgdisk -n 1:0:1800M /dev/mmcb1k0 # root.gpg
    # set partition types
    sgdisk -t 1:ef00 /dev/sda
    sgdisk -t 2:8200 /dev/sda
    sgdisk -t 3:8300 /dev/sda
    #sgdisk -t 1:0700 /dev/mmcb1k0
    # label partitions
    sgdisk -c 1:"UEFI Boot" /dev/sda
    sgdisk -c 2:"Swap" /dev/sda
    sgdisk -c 3:"LUKS" /dev/sda
    #sgdisk -c 1:"Key" /dev/mmcb1k0
    echo -e "create gpg file\n"
    # create gpg file
    dd if=/dev/urandom bs=512 count=4 | gpg -v --cipher-algo aes256 --digest-algo sha512 -c -a > /root/root.gpg
    echo -e "format LUKS on root\n"
    # format LUKS on root
    gpg -q -d /root/root.gpg 2>/dev/null | cryptsetup -v --key-file=- -c aes-xts-plain -s 512 --hash sha512 luksFormat /dev/sda3
    echo -e "open LUKS on root\n"
    gpg -d /root/root.gpg 2>/dev/null | cryptsetup -v --key-file=- luksOpen /dev/sda3 root
    # NOTE: make sure to add dm_crypt and aes_i586 to MODULES in rc.conf
    # NOTE2: actually this isn't required since we're mounting an encrypted root and grub2/initramfs handles this before we even get to rc.conf
    # make filesystems
    # following swap related commands not used now that we're encrypting our swap partition
    #mkswap /dev/sda2
    #swapon /dev/sda2
    #mkfs.ext4 /dev/sda3 # this is where we'd create an unencrypted root partition, but we're using luks instead
    echo -e "\nCreating Filesystems...\n$HR"
    # make filesystems
    mkfs.ext4 /dev/mapper/root
    mkfs.vfat -F32 /dev/sda1
    #mkfs.vfat -F32 /dev/mmcb1k0p1
    echo -e "mount targets\n"
    # mount target
    #mount /dev/sda3 ${INSTALL_TARGET} # this is where we'd mount the unencrypted root partition
    mount /dev/mapper/root ${INSTALL_TARGET}
    # mount target
    mkdir ${INSTALL_TARGET}
    # mkdir ${INSTALL_TARGET}/key
    # mount -t vfat /dev/mmcb1k0p1 ${INSTALL_TARGET}/key
    mkdir ${INSTALL_TARGET}/boot
    mount -t vfat /dev/sda1 ${INSTALL_TARGET}/boot
    # Install base, necessary utilities
    mkdir -p ${INSTALL_TARGET}/var/lib/pacman
    ${TARGET_PACMAN} -Sy
    ${TARGET_PACMAN} -Su base
    # curl could be installed later but we want it ready for rankmirrors
    ${TARGET_PACMAN} -S curl
    ${TARGET_PACMAN} -S libusb-compat gnupg
    ${TARGET_PACMAN} -R grub
    rm -rf ${INSTALL_TARGET}/boot/grub
    ${TARGET_PACMAN} -S grub2-efi-x86_64
    # Configure new system
    SetValue HOSTNAME ${HOSTNAME} ${INSTALL_TARGET}/etc/rc.conf
    sed -i "s/^\(127\.0\.0\.1.*\)$/\1 ${HOSTNAME}/" ${INSTALL_TARGET}/etc/hosts
    SetValue CONSOLEFONT Lat2-Terminus16 ${INSTALL_TARGET}/etc/rc.conf
    #following replaced due to netcfg
    #SetValue interface eth0 ${INSTALL_TARGET}/etc/rc.conf
    # write fstab
    # You can use UUID's or whatever you want here, of course. This is just
    # the simplest approach and as long as your drives aren't changing values
    # randomly it should work fine.
    cat > ${INSTALL_TARGET}/etc/fstab <<FSTAB_EOF
    # /etc/fstab: static file system information
    # <file system> <dir> <type> <options> <dump> <pass>
    tmpfs /tmp tmpfs nodev,nosuid 0 0
    /dev/sda1 /boot vfat defaults 0 0
    /dev/mapper/cryptswap none swap defaults 0 0
    /dev/mapper/root / ext4 defaults,noatime 0 1
    FSTAB_EOF
    # write etwo
    mkdir -p /lib/initcpio/hooks/
    mkdir -p /lib/initcpio/install/
    cp /src/etwo_hooks /lib/initcpio/hooks/etwo
    cp /src/etwo_install /lib/initcpio/install/etwo
    mkdir -p ${INSTALL_TARGET}/lib/initcpio/hooks/
    mkdir -p ${INSTALL_TARGET}/lib/initcpio/install/
    cp /src/etwo_hooks ${INSTALL_TARGET}/lib/initcpio/hooks/etwo
    cp /src/etwo_install ${INSTALL_TARGET}/lib/initcpio/install/etwo
    # write crypttab
    # encrypted swap (random passphrase on boot)
    echo cryptswap /dev/sda2 SWAP "-c aes-xts-plain -h whirlpool -s 512" >> ${INSTALL_TARGET}/etc/crypttab
    # copy configs we want to carry over to target from install environment
    mv ${INSTALL_TARGET}/etc/resolv.conf ${INSTALL_TARGET}/etc/resolv.conf.orig
    cp /etc/resolv.conf ${INSTALL_TARGET}/etc/resolv.conf
    mkdir -p ${INSTALL_TARGET}/tmp
    cp /tmp/pacman.conf ${INSTALL_TARGET}/tmp/pacman.conf
    # mount proc, sys, dev in install root
    mount -t proc proc ${INSTALL_TARGET}/proc
    mount -t sysfs sys ${INSTALL_TARGET}/sys
    mount -o bind /dev ${INSTALL_TARGET}/dev
    echo -e "umount boot\n"
    # we have to remount /boot from inside the chroot
    umount ${INSTALL_TARGET}/boot
    # Create install_efi script (to be run *after* chroot /install)
    touch ${INSTALL_TARGET}/install_efi
    chmod a+x ${INSTALL_TARGET}/install_efi
    cat > ${INSTALL_TARGET}/install_efi <<EFI_EOF
    # functions (these could be a library, but why overcomplicate things
    SetValue () { VALUENAME="\$1" NEWVALUE="\$2" FILEPATH="\$3"; sed -i "s+^#\?\(\${VALUENAME}\)=.*\$+\1=\${NEWVALUE}+" "\${FILEPATH}"; }
    CommentOutValue () { VALUENAME="\$1" FILEPATH="\$2"; sed -i "s/^\(\${VALUENAME}.*\)\$/#\1/" "\${FILEPATH}"; }
    UncommentValue () { VALUENAME="\$1" FILEPATH="\$2"; sed -i "s/^#\(\${VALUENAME}.*\)\$/\1/" "\${FILEPATH}"; }
    echo -e "mount boot\n"
    # remount here or grub et al gets confused
    mount -t vfat /dev/sda1 /boot
    # mkinitcpio
    # NOTE: intel_agp drm and i915 for intel graphics
    SetValue MODULES '\\"dm_mod dm_crypt aes_x86_64 ext2 ext4 vfat intel_agp drm i915\\"' /etc/mkinitcpio.conf
    SetValue HOOKS '\\"base udev pata scsi sata usb usbinput keymap consolefont etwo encrypt filesystems\\"' /etc/mkinitcpio.conf
    SetValue BINARIES '\\"/usr/bin/gpg\\"' /etc/mkinitcpio.conf
    mkinitcpio -p linux
    # kernel modules for EFI install
    modprobe efivars
    modprobe dm-mod
    # locale-gen
    UncommentValue de_AT /etc/locale.gen
    locale-gen
    # install and configure grub2
    # did this above
    #${CHROOT_PACMAN} -Sy
    #${CHROOT_PACMAN} -R grub
    #rm -rf /boot/grub
    #${CHROOT_PACMAN} -S grub2-efi-x86_64
    # you can be surprisingly sloppy with the root value you give grub2 as a kernel option and
    # even omit the cryptdevice altogether, though it will wag a finger at you for using
    # a deprecated syntax, so we're using the correct form here
    # NOTE: take out i915.modeset=1 unless you are on intel graphics
    SetValue GRUB_CMDLINE_LINUX '\\"cryptdevice=/dev/sda3:root cryptkey=/dev/sda1:vfat:/root.gpg add_efi_memmap i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 pcie_aspm=force quiet\\"' /etc/default/grub
    # set output to graphical
    SetValue GRUB_TERMINAL_OUTPUT gfxterm /etc/default/grub
    SetValue GRUB_GFXMODE 960x600x32,auto /etc/default/grub
    SetValue GRUB_GFXPAYLOAD_LINUX keep /etc/default/grub # comment out this value if text only mode
    # install the actual grub2. Note that despite our --boot-directory option we will still need to move
    # the grub directory to /boot/grub during grub-mkconfig operations until grub2 gets patched (see below)
    grub_efi_x86_64-install --bootloader-id=grub --no-floppy --recheck
    # create our EFI boot entry
    # bug in the HP bios firmware (F.08)
    efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "ARCH LINUX" --loader "\\\\grub\\\\grub.efi"
    # copy font for grub2
    cp /usr/share/grub/unicode.pf2 /boot/grub
    # generate config file
    grub-mkconfig -o /boot/grub/grub.cfg
    exit
    EFI_EOF
    # Install EFI using script inside chroot
    chroot ${INSTALL_TARGET} /install_efi
    rm ${INSTALL_TARGET}/install_efi
    # Post install steps
    # anything you want to do post install. run the script automatically or
    # manually
    touch ${INSTALL_TARGET}/post_install
    chmod a+x ${INSTALL_TARGET}/post_install
    cat > ${INSTALL_TARGET}/post_install <<POST_EOF
    set -o errexit
    set -o nounset
    # functions (these could be a library, but why overcomplicate things
    SetValue () { VALUENAME="\$1" NEWVALUE="\$2" FILEPATH="\$3"; sed -i "s+^#\?\(\${VALUENAME}\)=.*\$+\1=\${NEWVALUE}+" "\${FILEPATH}"; }
    CommentOutValue () { VALUENAME="\$1" FILEPATH="\$2"; sed -i "s/^\(\${VALUENAME}.*\)\$/#\1/" "\${FILEPATH}"; }
    UncommentValue () { VALUENAME="\$1" FILEPATH="\$2"; sed -i "s/^#\(\${VALUENAME}.*\)\$/\1/" "\${FILEPATH}"; }
    # root password
    echo -e "${HR}\\nNew root user password\\n${HR}"
    passwd
    # add user
    echo -e "${HR}\\nNew non-root user password (username:${USERNAME})\\n${HR}"
    groupadd sudo
    useradd -m -g users -G audio,lp,optical,storage,video,games,power,scanner,network,sudo,wheel -s /bin/bash ${USERNAME}
    passwd ${USERNAME}
    # mirror ranking
    echo -e "${HR}\\nRanking Mirrors (this will take a while)\\n${HR}"
    cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
    mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.all
    sed -i "s/#S/S/" /etc/pacman.d/mirrorlist.all
    rankmirrors -n 5 /etc/pacman.d/mirrorlist.all > /etc/pacman.d/mirrorlist
    # temporary fix for locale.sh update conflict
    mv /etc/profile.d/locale.sh /etc/profile.d/locale.sh.preupdate || true
    # yaourt repo (add to target pacman, not tmp pacman.conf, for ongoing use)
    echo -e "\\n[archlinuxfr]\\nServer = http://repo.archlinux.fr/\\\$arch" >> /etc/pacman.conf
    echo -e "\\n[haskell]\\nServer = http://www.kiwilight.com/\\\$repo/\\\$arch" >> /etc/pacman.conf
    # additional groups and utilities
    pacman --noconfirm -Syu
    pacman --noconfirm -S base-devel
    pacman --noconfirm -S yaourt
    # sudo
    pacman --noconfirm -S sudo
    cp /etc/sudoers /tmp/sudoers.edit
    sed -i "s/#\s*\(%wheel\s*ALL=(ALL)\s*ALL.*$\)/\1/" /tmp/sudoers.edit
    sed -i "s/#\s*\(%sudo\s*ALL=(ALL)\s*ALL.*$\)/\1/" /tmp/sudoers.edit
    visudo -qcsf /tmp/sudoers.edit && cat /tmp/sudoers.edit > /etc/sudoers
    # power
    pacman --noconfirm -S acpi acpid acpitool cpufrequtils
    yaourt --noconfirm -S powertop2
    sed -i "/^DAEMONS/ s/)/ @acpid)/" /etc/rc.conf
    sed -i "/^MODULES/ s/)/ acpi-cpufreq cpufreq_ondemand cpufreq_powersave coretemp)/" /etc/rc.conf
    # following requires my acpi handler script
    echo "/etc/acpi/handler.sh boot" > /etc/rc.local
    # time
    pacman --noconfirm -S ntp
    sed -i "/^DAEMONS/ s/hwclock /!hwclock @ntpd /" /etc/rc.conf
    # wireless (wpa supplicant should already be installed)
    pacman --noconfirm -S iw wpa_supplicant rfkill
    pacman --noconfirm -S netcfg wpa_actiond ifplugd
    mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.orig
    echo -e "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=network\nupdate_config=1" > /etc/wpa_supplicant.conf
    # make sure to copy /etc/network.d/examples/wireless-wpa-config to /etc/network.d/home and edit
    sed -i "/^DAEMONS/ s/)/ @net-auto-wireless @net-auto-wired)/" /etc/rc.conf
    sed -i "/^DAEMONS/ s/ network / /" /etc/rc.conf
    echo -e "\nWIRELESS_INTERFACE=wlan0" >> /etc/rc.conf
    echo -e "WIRED_INTERFACE=eth0" >> /etc/rc.conf
    echo "options iwlagn led_mode=2" > /etc/modprobe.d/iwlagn.conf
    # sound
    pacman --noconfirm -S alsa-utils alsa-plugins
    sed -i "/^DAEMONS/ s/)/ @alsa)/" /etc/rc.conf
    mv /etc/asound.conf /etc/asound.conf.orig || true
    #if alsamixer isn't working, try alsamixer -Dhw and speaker-test -Dhw -c 2
    # video
    pacman --noconfirm -S base-devel mesa mesa-demos
    # x
    #pacman --noconfirm -S xorg xorg-xinit xorg-utils xorg-server-utils xdotool xorg-xlsfonts
    #yaourt --noconfirm -S xf86-input-wacom-git # NOT NEEDED? input-wacom-git
    #TODO: cut down the install size
    #pacman --noconfirm -S xorg-server xorg-xinit xorg-utils xorg-server-utils
    # TODO: wacom
    # environment/wm/etc.
    #pacman --noconfirm -S xfce4 compiz ccsm
    #pacman --noconfirm -S xcompmgr
    #yaourt --noconfirm -S physlock unclutter
    #pacman --noconfirm -S rxvt-unicode urxvt-url-select hsetroot
    #pacman --noconfirm -S gtk2 #gtk3 # for taffybar?
    #pacman --noconfirm -S ghc
    # note: try installing alex and happy from cabal instead
    #pacman --noconfirm -S haskell-platform haskell-hscolour
    #yaourt --noconfirm -S xmonad-darcs xmonad-contrib-darcs xcompmgr
    #yaourt --noconfirm -S xmobar-git
    # TODO: edit xfce to use compiz
    # TODO: xmonad, but deal with video tearing
    # TODO: xmonad-darcs fails to install from AUR. haskell dependency hell.
    # switching to cabal
    # fonts
    pacman --noconfirm -S terminus-font
    yaourt --noconfirm -S webcore-fonts
    yaourt --noconfirm -S fontforge libspiro
    yaourt --noconfirm -S freetype2-git-infinality
    # TODO: sed infinality and change to OSX or OSX2 mode
    # and create the sym link from /etc/fonts/conf.avail to conf.d
    # misc apps
    #pacman --noconfirm -S htop openssh keychain bash-completion git vim
    #pacman --noconfirm -S chromium flashplugin
    #pacman --noconfirm -S scrot mypaint bc
    #yaourt --noconfirm -S task-git stellarium googlecl
    # TODO: argyll
    POST_EOF
    # Post install in chroot
    #echo "chroot and run /post_install"
    chroot /install /post_install
    rm /install/post_install
    # copy grub.efi file to the default HP EFI boot manager path
    mkdir -p ${INSTALL_TARGET}/boot/EFI/Microsoft/BOOT/
    mkdir -p ${INSTALL_TARGET}/boot/EFI/BOOT/
    cp ${INSTALL_TARGET}/boot/grub/grub.efi ${INSTALL_TARGET}/boot/EFI/Microsoft/BOOT/bootmgfw.efi
    cp ${INSTALL_TARGET}/boot/grub/grub.efi ${INSTALL_TARGET}/boot/EFI/BOOT/BOOTX64.EFI
    cp /root/root.gpg ${INSTALL_TARGET}/boot/
    # NOTES/TODO

  • [SOLVED] 3d Acceleration on Arch Linux guest

    I've just installed the latest FTP Arch Linux (2009.02) as a Guest running in Virtual Box 3.0.2 in my Windows 7 host, and I cannot get Xorg working at all.
    - 3D Acceleration is enabled for the VM, and 128MB of video memory allocated
    - Guest Additions were installed successfully, added rc.vboxadd to daemons, and everything loads ok on startup.
    Output of 'dmesg | grep vbox':
    vboxadd: Successfully loaded version 3.0.2 (interface 0x0010004)
    vboxvfs: Successfully loaded version 3.0.2 (interface 0x0010004)
    [drm] Initialized vboxvideo 1.0.0 20090303 for 0000:00:02.0 on minor 0
    Here is my .xinitrc:
    /usr/bin/VBoxClient-all
    I've symlinked vboxvideo_dri.so since the installer didn't do it.
    Output of 'ls -l /usr/lib/xorg/modules/dri/vboxvideo_dri.so':
    lrwxrwxrwx 1 root root 19 2009-07-31 22:42 /usr/lib/xorg/modules/dri/vboxvideo_dri.so -> /usr/lib/VBoxOGL.so
    And error when I run 'startx':
    (EE) AIGLX error: dlopen of /usr/lib/xorg/modules/dri/vboxvideo_dri.so failed (libXcomposite.so.1: cannot open shared object file: No such file or directory)
    (EE) AIGLX: reverting to software rendering
    waiting for X server to shut down
    And then it shuts down, without even trying to load swrast_dri.so. But the weirdest part is, that symlink exists, but X is saying it doesn't! I've restarted the VM and still get the same error.
    Here is my xorg.conf (created by installing GA), and I do have HAL up and running, loaded before the rc.vboxadd daemon:
    # Default xorg.conf for Xorg 1.5+ without PCI_TXT_IDS_PATH enabled.
    # This file was created by VirtualBox Additions installer as it
    # was unable to find any existing configuration file for X.
    Section "Device"
    Identifier "VirtualBox Video Card"
    Driver "vboxvideo"
    EndSection
    So... what next? 
    Last edited by timmahcheese (2009-08-03 15:20:55)

    Silly me, I forgot the libxcomposite package. I guess I should read the errors closer.
    Anyway, I'm still getting an error (signal 11) being caused by VBoxClient-all. Here is my Xorg.0.log:
    X.Org X Server 1.6.2
    Release Date: 2009-7-7
    X Protocol Version 11, Revision 0
    Build Operating System: Linux 2.6.30-ARCH i686
    Current Operating System: Linux obi-wan 2.6.30-ARCH #1 SMP PREEMPT Mon Jul 20 11:20:32 UTC 2009 i686
    Build Date: 18 July 2009 08:27:13PM
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
    Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    (==) Log file: "/var/log/Xorg.0.log", Time: Sun Aug 2 23:20:02 2009
    (==) Using config file: "/etc/X11/xorg.conf"
    (==) No Layout section. Using the first Screen section.
    (==) No screen section available. Using defaults.
    (**) |-->Screen "Default Screen Section" (0)
    (**) | |-->Monitor "<default monitor>"
    (==) No device specified for screen "Default Screen Section".
    Using the first device section listed.
    (**) | |-->Device "VirtualBox Video Card"
    (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
    (==) Automatically adding devices
    (==) Automatically enabling devices
    (WW) The directory "/usr/share/fonts/Type1" does not exist.
    Entry deleted from font path.
    (==) FontPath set to:
    /usr/share/fonts/misc,
    /usr/share/fonts/100dpi:unscaled,
    /usr/share/fonts/75dpi:unscaled,
    /usr/share/fonts/TTF,
    built-ins
    (==) ModulePath set to "/usr/lib/xorg/modules"
    (II) Cannot locate a core pointer device.
    (II) Cannot locate a core keyboard device.
    (II) The server relies on HAL to provide the list of input devices.
    If no devices become available, reconfigure HAL or disable AllowEmptyInput.
    (II) Loader magic: 0x7a40
    (II) Module ABI versions:
    X.Org ANSI C Emulation: 0.4
    X.Org Video Driver: 5.0
    X.Org XInput driver : 4.0
    X.Org Server Extension : 2.0
    (II) Loader running on linux
    (--) using VT number 7
    (--) PCI:*(0:0:2:0) 80ee:beef:0000:0000 InnoTek Systemberatung GmbH VirtualBox Graphics Adapter rev 0, Mem @ 0xe0000000/134217728
    (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)
    (II) No APM support in BIOS or kernel
    (II) System resource ranges:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [5] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    (II) LoadModule: "extmod"
    (II) Loading /usr/lib/xorg/modules/extensions//libextmod.so
    (II) Module extmod: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    Module class: X.Org Server Extension
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension MIT-SCREEN-SAVER
    (II) Loading extension XFree86-VidModeExtension
    (II) Loading extension XFree86-DGA
    (II) Loading extension DPMS
    (II) Loading extension XVideo
    (II) Loading extension XVideo-MotionCompensation
    (II) Loading extension X-Resource
    (II) LoadModule: "dbe"
    (II) Loading /usr/lib/xorg/modules/extensions//libdbe.so
    (II) Module dbe: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    Module class: X.Org Server Extension
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension DOUBLE-BUFFER
    (II) LoadModule: "glx"
    (II) Loading /usr/lib/xorg/modules/extensions//libglx.so
    (II) Module glx: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    ABI class: X.Org Server Extension, version 2.0
    (==) AIGLX enabled
    (II) Loading extension GLX
    (II) LoadModule: "record"
    (II) Loading /usr/lib/xorg/modules/extensions//librecord.so
    (II) Module record: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.13.0
    Module class: X.Org Server Extension
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension RECORD
    (II) LoadModule: "dri"
    (II) Loading /usr/lib/xorg/modules/extensions//libdri.so
    (II) Module dri: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension XFree86-DRI
    (II) LoadModule: "dri2"
    (II) Loading /usr/lib/xorg/modules/extensions//libdri2.so
    (II) Module dri2: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.1.0
    ABI class: X.Org Server Extension, version 2.0
    (II) Loading extension DRI2
    (II) LoadModule: "vboxvideo"
    (II) Loading /usr/lib/xorg/modules/drivers//vboxvideo_drv.so
    (II) Module vboxvideo: vendor="Sun Microsystems, Inc."
    compiled for 1.5.99.901, module version = 1.0.1
    Module class: X.Org Video Driver
    ABI class: X.Org Video Driver, version 5.0
    (II) VBoxVideo: guest driver for VirtualBox: vbox
    (II) Primary Device is: PCI 00@00:02:0
    (II) resource ranges after xf86ClaimFixedResources() call:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [5] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    (II) resource ranges after probing:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] 0 0 0x000a0000 - 0x000affff (0x10000) MS[b]
    [5] 0 0 0x000b0000 - 0x000b7fff (0x8000) MS[b]
    [6] 0 0 0x000b8000 - 0x000bffff (0x8000) MS[b]
    [7] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [8] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    [9] 0 0 0x000003b0 - 0x000003bb (0xc) IS[b]
    [10] 0 0 0x000003c0 - 0x000003df (0x20) IS[b]
    (II) VBoxVideo(0): VirtualBox guest additions video driver version 3.0.2
    (II) Loading sub module "vbe"
    (II) LoadModule: "vbe"
    (II) Loading /usr/lib/xorg/modules//libvbe.so
    (II) Module vbe: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.1.0
    ABI class: X.Org Video Driver, version 5.0
    (II) Loading sub module "int10"
    (II) LoadModule: "int10"
    (II) Loading /usr/lib/xorg/modules//libint10.so
    (II) Module int10: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    ABI class: X.Org Video Driver, version 5.0
    (II) VBoxVideo(0): initializing int10
    (II) VBoxVideo(0): Primary V_BIOS segment is: 0xc000
    (II) VBoxVideo(0): VESA BIOS detected
    (II) VBoxVideo(0): VESA VBE Version 2.0
    (II) VBoxVideo(0): VESA VBE Total Mem: 131072 kB
    (II) VBoxVideo(0): VESA VBE OEM: VirtualBox VBE BIOS http://www.virtualbox.org/
    (II) VBoxVideo(0): VESA VBE OEM Software Rev: 0.2
    (II) VBoxVideo(0): VESA VBE OEM Vendor: Sun Microsystems, Inc.
    (II) VBoxVideo(0): VESA VBE OEM Product: VirtualBox VBE Adapter
    (II) VBoxVideo(0): VESA VBE OEM Product Rev: Sun VirtualBox Version 3.0.2
    (II) Loading sub module "ramdac"
    (II) LoadModule: "ramdac"
    (II) Module "ramdac" already built-in
    (II) Loading sub module "fb"
    (II) LoadModule: "fb"
    (II) Loading /usr/lib/xorg/modules//libfb.so
    (II) Module fb: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    ABI class: X.Org ANSI C Emulation, version 0.4
    (II) Loading sub module "shadowfb"
    (II) LoadModule: "shadowfb"
    (II) Loading /usr/lib/xorg/modules//libshadowfb.so
    (II) Module shadowfb: vendor="X.Org Foundation"
    compiled for 1.6.2, module version = 1.0.0
    ABI class: X.Org ANSI C Emulation, version 0.4
    (II) VBoxVideo(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
    (==) VBoxVideo(0): Depth 24, (--) framebuffer bpp 32
    (II) VBoxVideo(0): Output VBOX1 has no monitor section
    (II) VBoxVideo(0): The maximum supported resolution is currently 32000x32000
    (II) VBoxVideo(0): Output VBOX1 has no monitor section
    (II) VBoxVideo(0): Output VBOX1 connected
    (II) VBoxVideo(0): Using exact sizes for initial modes
    (II) VBoxVideo(0): Output VBOX1 using initial mode 1024x768
    (==) VBoxVideo(0): RGB weight 888
    (==) VBoxVideo(0): Default visual is TrueColor
    (==) VBoxVideo(0): Using gamma correction (1.0, 1.0, 1.0)
    (==) VBoxVideo(0): DPI set to (96, 96)
    (II) Loading sub module "dri"
    (II) LoadModule: "dri"
    (II) Reloading /usr/lib/xorg/modules/extensions//libdri.so
    (--) Depth 24 pixmap format is 32 bpp
    (II) do I need RAC? No, I don't.
    (II) resource ranges after preInit:
    [0] -1 0 0xffffffff - 0xffffffff (0x1) MX[b]
    [1] -1 0 0x000f0000 - 0x000fffff (0x10000) MX[b]
    [2] -1 0 0x000c0000 - 0x000effff (0x30000) MX[b]
    [3] -1 0 0x00000000 - 0x0009ffff (0xa0000) MX[b]
    [4] 0 0 0x000a0000 - 0x000affff (0x10000) MS[b]
    [5] 0 0 0x000b0000 - 0x000b7fff (0x8000) MS[b]
    [6] 0 0 0x000b8000 - 0x000bffff (0x8000) MS[b]
    [7] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[b]
    [8] -1 0 0x00000000 - 0x00000000 (0x1) IX[b]
    [9] 0 0 0x000003b0 - 0x000003bb (0xc) IS[b]
    [10] 0 0 0x000003c0 - 0x000003df (0x20) IS[b]
    (==) VBoxVideo(0): Default visual is TrueColor
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:00:02.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenByBusid: drmOpenMinor returns 10
    drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
    (II) [drm] DRM interface version 1.3
    (II) [drm] DRM open master succeeded.
    (II) VBoxVideo(0): [drm] Using the DRM lock SAREA also for drawables.
    (II) VBoxVideo(0): [drm] framebuffer handle = 0xe0000000
    (II) VBoxVideo(0): [drm] added 1 reserved context for kernel
    (II) VBoxVideo(0): X context handle = 0x1
    (II) VBoxVideo(0): [drm] installed DRM signal handler
    (II) VBoxVideo(0): visual configurations initialized
    (==) VBoxVideo(0): Backing store disabled
    (II) VBoxVideo(0): RandR 1.2 enabled, ignore the following RandR disabled message.
    (II) VBoxVideo(0): DPMS enabled
    (II) VBoxVideo(0): The VBox video extensions are now enabled.
    (II) VBoxVideo(0): [DRI] installation complete
    (--) RandR disabled
    (II) Initializing built-in extension Generic Event Extension
    (II) Initializing built-in extension SHAPE
    (II) Initializing built-in extension MIT-SHM
    (II) Initializing built-in extension XInputExtension
    (II) Initializing built-in extension XTEST
    (II) Initializing built-in extension BIG-REQUESTS
    (II) Initializing built-in extension SYNC
    (II) Initializing built-in extension XKEYBOARD
    (II) Initializing built-in extension XC-MISC
    (II) Initializing built-in extension SECURITY
    (II) Initializing built-in extension XINERAMA
    (II) Initializing built-in extension XFIXES
    (II) Initializing built-in extension RENDER
    (II) Initializing built-in extension RANDR
    (II) Initializing built-in extension COMPOSITE
    (II) Initializing built-in extension DAMAGE
    (II) AIGLX: Screen 0 is not DRI2 capable
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:00:02.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenByBusid: drmOpenMinor returns 11
    drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
    (II) Next line is added to allow vboxvideo_drv.so to appear as whitelisted driver
    (II) The file referenced, is *NOT* loaded
    (II) Loading /usr/lib/xorg/modules/drivers//ati_drv.so
    (EE) AIGLX error: vboxvideo does not export required DRI extension
    (EE) AIGLX: reverting to software rendering
    (II) AIGLX: Loaded and initialized /usr/lib/xorg/modules/dri/swrast_dri.so
    (II) GLX: Initialized DRISWRAST GL provider for screen 0
    (II) VBoxVideo(0): Setting screen physical size to 270 x 203
    (II) config/hal: Adding input device Macintosh mouse button emulation
    (II) LoadModule: "evdev"
    (II) Loading /usr/lib/xorg/modules/input//evdev_drv.so
    (II) Module evdev: vendor="X.Org Foundation"
    compiled for 1.6.1, module version = 2.2.2
    Module class: X.Org XInput Driver
    ABI class: X.Org XInput driver, version 4.0
    (**) Macintosh mouse button emulation: always reports core events
    (**) Macintosh mouse button emulation: Device: "/dev/input/event0"
    (II) Macintosh mouse button emulation: Found 3 mouse buttons
    (II) Macintosh mouse button emulation: Found x and y relative axes
    (II) Macintosh mouse button emulation: Configuring as mouse
    (**) Macintosh mouse button emulation: YAxisMapping: buttons 4 and 5
    (**) Macintosh mouse button emulation: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
    (II) XINPUT: Adding extended input device "Macintosh mouse button emulation" (type: MOUSE)
    (**) Macintosh mouse button emulation: (accel) keeping acceleration scheme 1
    (**) Macintosh mouse button emulation: (accel) filter chain progression: 2.00
    (**) Macintosh mouse button emulation: (accel) filter stage 0: 20.00 ms
    (**) Macintosh mouse button emulation: (accel) set acceleration profile 0
    (II) config/hal: Adding input device ImExPS/2 Generic Explorer Mouse
    (**) ImExPS/2 Generic Explorer Mouse: always reports core events
    (**) ImExPS/2 Generic Explorer Mouse: Device: "/dev/input/event5"
    (II) ImExPS/2 Generic Explorer Mouse: Found 5 mouse buttons
    (II) ImExPS/2 Generic Explorer Mouse: Found x and y relative axes
    (II) ImExPS/2 Generic Explorer Mouse: Found scroll wheel(s)
    (II) ImExPS/2 Generic Explorer Mouse: Configuring as mouse
    (**) ImExPS/2 Generic Explorer Mouse: YAxisMapping: buttons 4 and 5
    (**) ImExPS/2 Generic Explorer Mouse: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
    (II) XINPUT: Adding extended input device "ImExPS/2 Generic Explorer Mouse" (type: MOUSE)
    (**) ImExPS/2 Generic Explorer Mouse: (accel) keeping acceleration scheme 1
    (**) ImExPS/2 Generic Explorer Mouse: (accel) filter chain progression: 2.00
    (**) ImExPS/2 Generic Explorer Mouse: (accel) filter stage 0: 20.00 ms
    (**) ImExPS/2 Generic Explorer Mouse: (accel) set acceleration profile 0
    (II) config/hal: Adding input device AT Translated Set 2 keyboard
    (**) AT Translated Set 2 keyboard: always reports core events
    (**) AT Translated Set 2 keyboard: Device: "/dev/input/event1"
    (II) AT Translated Set 2 keyboard: Found keys
    (II) AT Translated Set 2 keyboard: Configuring as keyboard
    (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD)
    (**) Option "xkb_rules" "evdev"
    (**) Option "xkb_model" "evdev"
    (**) Option "xkb_layout" "us"
    (II) config/hal: Adding input device VirtualBox Guest Service
    (II) LoadModule: "vboxmouse"
    (II) Loading /usr/lib/xorg/modules/input//vboxmouse_drv.so
    (II) Module vboxmouse: vendor="Sun Microsystems Inc."
    compiled for 0.0.0, module version = 1.0.0
    Module class: X.Org XInput Driver
    ABI class: X.Org XInput driver, version 4.0
    (**) VirtualBox Guest Service: always reports core events
    (**) VirtualBox Guest Service: Device: "/dev/vboxadd"
    (II) XINPUT: Adding extended input device "VirtualBox Guest Service" (type: MOUSE)
    (**) VirtualBox Guest Service: (accel) keeping acceleration scheme 1
    (**) VirtualBox Guest Service: (accel) filter chain progression: 2.00
    (**) VirtualBox Guest Service: (accel) filter stage 0: 20.00 ms
    (**) VirtualBox Guest Service: (accel) set acceleration profile 0
    (**) VirtualBox Guest Service: Mouse Integration associated with screen 0
    (II) VirtualBox Guest Service: On.
    Backtrace:
    0: /usr/bin/X(xorg_backtrace+0x3b) [0x813154b]
    1: /usr/bin/X(xf86SigHandler+0x9e) [0x80cacee]
    2: [0xb8008400]
    3: /usr/bin/X(Dispatch+0x80) [0x808c350]
    4: /usr/bin/X(main+0x395) [0x8072005]
    5: /lib/libc.so.6(__libc_start_main+0xe6) [0xb7be2a36]
    6: /usr/bin/X [0x80714b1]
    Fatal server error:
    Caught signal 11. Server aborting
    Please consult the The X.Org Foundation support
    at http://wiki.x.org
    for help.
    Please also check the log file at "/var/log/Xorg.0.log" for additional information.
    (II) Macintosh mouse button emulation: Close
    (II) UnloadModule: "evdev"
    (II) ImExPS/2 Generic Explorer Mouse: Close
    (II) UnloadModule: "evdev"
    (II) AT Translated Set 2 keyboard: Close
    (II) UnloadModule: "evdev"
    (II) VirtualBox Guest Service: Off.
    (II) VirtualBox Guest Service: Close
    (II) UnloadModule: "vboxmouse"
    Last edited by timmahcheese (2009-08-03 04:07:48)

  • Arch Linux Pacman Proxy Script

    Since my Arch box has no internet connection (yes, I'm that much of a masochist), I wrote a bash script to act as a proxy of sorts for pacman, at least as regards downloading. It took a while to get it working (intermittent web access and all) but here it finally is, as promised.
    It works well for me, and I only hope that it will help anyone else in the same situation (if there is anyone else in the same situation).
    The script has various options to explain everything you need to know, but here's a quick word of warning: it only works on POSIX-compatible computers (i.e. no Wintendows, usually) and the proxy box needs to have bash, wget, tar, grep and sed installed. I don't see this as being a problem, but if I'm wrong, tell me all about it.
    #!/bin/bash
    readonly VER="2.1"
    readonly wgetVER=`wget -V|sed '1!d'`
    # DEBUG levels:
    # Set to 0 for ALERT-level messages only
    # Set to 1 for INFO-level messages (I prefer this)
    # Set to 2 for DEBUG-level messages
    # Set to 3 for all messages
    readonly DEBUG=0
    # Set DEBUGLOG=1 to print ALERT, INFO and DEBUG messages to DEBUG.log
    readonly DEBUGLOG=0
    readonly COLOUR=true
    if [[ $COLOUR == true ]] ; then
    readonly red='\e[31m'
    readonly warn='\e[31;7m '
    readonly green='\e[32m'
    readonly lgreen='\e[32;1m'
    readonly yellow='\e[33;1m'
    readonly lblue='\e[34;1m'
    readonly dull='\e[0m' ; fi
    # Sticky details:
    # tar seems very slow (vfat? transform? USB?)
    function bugspray {
    [[ -z $2 ]] && verbosity=1 || verbosity=$2
    if (( DEBUG >= verbosity )) ; then
    (( $2 == 0 )) && intro="${warn}ALERT${dull} | "
    (( $2 == 1 )) && intro=" INFO | "
    (( $2 > 1 )) && intro=" ${yellow}DEBUG${dull} | "
    echo -e "$intro$1"
    (( DEBUGLOG == 1 )) && echo "`date +%F_%T` | $1">>log-alpps/DEBUG.log ; fi ; }
    function compare_versions {
    # Requires two ordinary, untweaked version strings, first local, second distant
    if [[ -z $2 ]] ; then
    bugspray "compare_versions didn't receive two variables." 2 ; fi
    update='no'
    [[ -z $2 ]] && return
    local localversion=(`echo $1|sed -r 's/([[:alpha:]]+)/ \1 /g;s/[\.:~_-]/ /g'`)
    local distantversion=(`echo $2|sed -r 's/([[:alpha:]]+)/ \1 /g;s/[\.:~_-]/ /g'`)
    local max=$((${#distantversion[*]}))
    bugspray "localversion: ${localversion[*]}; distantversion: ${distantversion[*]}" 2
    for (( x=0 ; (( x < $max )) ; $((x++)) )) ; do
    bugspray "local version part: `echo ${localversion[$x]}` | distant version part: `echo ${distantversion[$x]}`" 2
    if [[ `echo ${localversion[$x]}|grep -E '^[0-9]*$'` && `echo ${distantversion[$x]}|grep -E '^[0-9]*$'` ]] ; then
    bugspray "Numerical comparison" 2
    bugspray "localver (${localversion[$x]}) less than distantver (${distantversion[$x]}): $(( 10#${localversion[$x]} < 10#${distantversion[$x]} ))" 3
    # Different compare methods for numbers, single letters and multiple letters.
    if (( 10#${localversion[$x]} < 10#${distantversion[$x]} )) ; then
    update='yes'
    break ; fi ; fi
    if [[ `echo ${localversion[$x]}|grep -E '^[[:alpha:]]$'` && `echo ${distantversion[$x]}|grep -E '^[[:alpha:]]$'` ]] ; then # single letter -> compare
    bugspray "Lexicographical comparison" 2
    bugspray "localver (${localversion[$x]}) less than distantver (${distantversion[$x]}): [[ ${localversion[$x]} < ${distantversion[$x]} ]]" 3
    if [[ ${localversion[$x]} < ${distantversion[$x]} ]] ; then
    update='yes'
    break ; fi ; fi
    if [[ `echo ${localversion[$x]}|grep -E '^[[:alpha:]]+$'` && `echo ${distantversion[$x]}|grep -E '^[[:alpha:]]+$'` ]] ; then # string -> drop
    # cvs / git / beta -> what are the rules?
    bugspray "Sequence of letters. Not treating as version number." 2 ; fi
    done ; }
    function find_dependencies {
    # Determine existence via unique path
    bugspray "+ ${lgreen}Building download list for package \"$1\"${dull}" 1
    local packagename
    local dlfile
    local package_found=no
    if [[ `ls .temp-alpps/*.db/$1-* 2>/dev/null` ]] ; then
    bugspray "Analogous package-name file(s) found" 2
    for x in `ls .temp-alpps/*.db/$1-*/desc` ; do
    bugspray "Checking $x" 2
    packagename=`sed -r '/%NAME%/,+1!d;/%NAME%/d' $x`
    if [[ j$packagename == j$1 ]] ; then
    bugspray "Exact match found: $packagename = $1" 2
    dlfile=`sed '/%FILENAME%/,+1!d;/%FILENAME%/d' $x`
    local distantversion=`sed '/%VERSION%/,+1!d;/%VERSION%/d' $x`
    local package_full=$packagename-$distantversion
    local the_repo=`echo $x|sed -r 's/.temp-alpps\/(.*)\.db.*/\1/'`
    local the_path=`echo $x|sed -r 's/desc//'`
    unplus=`echo $packagename|sed 's/\+/\\\+/g'`
    local local_version=`sed -r '/^'$unplus' /!d;s/.* //' .temp-alpps/snapshot.state`
    package_found=yes
    break ; fi ; done ; fi
    if [[ -z $dlfile ]] ; then
    bugspray "Exact match not found -> looking for replacements." 2
    if ! [[ -z `grep $1 .temp-alpps/*.db/*/depends` ]] ; then
    local provisional=`grep $1 .temp-alpps/*.db/*/depends|sed -r 's/\/depends.*//'`
    for package in $provisional ; do
    local providence=`sed -r '/%PROVIDES%/,/^$/!d;/%PROVIDES%/d;/^$/d;s/>.*//;s/=.*//' $package/depends`
    for y in $providence ; do
    if [[ j$y == j$1 ]] ; then
    # But what about when several packages provide the same thing and ALPPS picks the wrong one? Can it happen?
    local newdep=`sed -r '/%NAME%/,+1!d;/%NAME%/d' $package/desc`
    bugspray " -> Package \"$newdep\" provides \"$1\"." 1
    find_dependencies $newdep
    break 2 ; fi ; done ; done
    if [[ -z $newdep ]] ; then
    bugspray "${warn}Warning:${dull} package \"$1\" not found in database." 0 ; fi ; fi ; fi
    bugspray "package: $1 | package_found = $package_found" 2
    # Add file to download_list if not up to date and if not already present
    if [[ j$package_found == jyes ]] ; then
    local already_got_one=no
    unplus=`echo $dlfile|sed 's/\+/\\\+/g'`
    [[ `echo $download_files|grep $unplus` ]] && already_got_one="yes" && bugspray "${green}Package in queue${dull}" 1
    [[ `ls downloads/$dlfile 2>/dev/null` ]] && already_got_one="yes" && bugspray "${green}Package proxied${dull}" 1
    compare_versions $local_version $distantversion
    bugspray "compare_versions says: $update" 2
    ! [[ -z $local_version || $update == yes ]] && already_got_one="yes" && bugspray "${green}Package already installed and up-to-date${dull}" 1
    if [[ j$already_got_one != jyes ]] ; then
    bugspray "${green}Confirm downloading${dull}" 1
    download_files+="$dlfile "
    download_array[${dlfile}]=$the_repo
    bugspray "Checking for further dependencies" 2
    if [[ -a $the_path/depends && `grep -E '^%DEPENDS%$' $the_path/depends` ]] ; then
    local dependency=`sed -r '/%DEPENDS%/d;/^$/q' $the_path/depends`
    bugspray "Dependencies of \"$packagename\":$dependency" 3
    for x in $dependency ; do
    # Is this dependency already installed? Sort-of the same as higher up; it just saves time here.
    local depname=`echo $x|sed -r 's/>.*//;s/=.*//'`
    local depminver=`echo $x|sed -r 's/.*>//'`
    bugspray "Dependency name: \"$depname\"" 2
    if ! [[ `grep -E '^$depname ' .temp-alpps/snapshot.state` ]] ; then
    find_dependencies $depname ; fi ; done
    else
    bugspray "${lblue}End of the line${dull}: package \"$packagename\" has no dependencies." 2
    true ; fi ; fi ; fi ; }
    function failover_fetch {
    echo "Downloading `echo $1|sed 's/.*\///'`"
    [[ -d log-alpps/ ]] || mkdir log-alpps/
    [[ -z $success ]] || unset success
    for mirror in $(<.temp-alpps/snapshot.mirrorlist) ; do
    # If DEBUG>0, shouldn't redirect output
    url=`echo $mirror|sed 's/$arch/'$arch'/;s/$repo/'${download_array[$1]}'/'`/$1
    bugspray "Connecting to $url" 2
    wget -o .temp-alpps/very-temp-log -U "Arch Linux Pacman Proxy Script version $VER / $wgetVER" -P downloads/ $url && success=true
    cat .temp-alpps/very-temp-log>>log-alpps/download.log
    rm -f .temp-alpps/very-temp-log
    if [[ -n $success ]] ; then
    bugspray "Download: \$success = true" 2
    break ; fi ; done
    if [[ -z $success ]] ; then
    bugspray "${warn}FAIL:${dull} $1 not accessible on known mirrors." 0 ; fi ; }
    case $1 in
    warranty)
    echo
    echo -e " ${green}Warranty${dull}"
    echo -e " ${green}========${dull}"
    echo " This program is free software. It comes without any warranty, to"
    echo " the extent permitted by applicable law. You can redistribute it"
    echo " and/or modify it under the terms of the Do What The Fuck You Want"
    echo " To Public License, Version 2, as published by Sam Hocevar. See"
    echo " http://sam.zoy.org/wtfpl/COPYING for more details."
    echo
    howto)
    echo
    echo -e " ${green}How to use ALPPS${dull}"
    echo -e " ${green}================${dull}"
    echo -e " ${yellow}+ Step 0${dull}: prime the engine"
    echo " On your offline box, copy the ALPPS script onto a removable medium, cd into"
    echo " it's directory, then run it with the \"init\" option. This essentially"
    echo " takes a snapshot of your system, package-wise. Your removable medium is"
    echo " now ready for use!"
    echo -e " ${yellow}+ Step 1${dull}:"
    echo " On the proxy box the first order of business is to download and decompress"
    echo " the current package lists. You can do this with the \"fetchdb\" option."
    echo -e " ${yellow}+ Step 1 alt${dull}:"
    echo " If you want to download the package lists without decompressing them,"
    echo " \"fetchdb simple\" will do this. It's a lot quicker, but please keep"
    echo " in mind that you cannot then do anything in step 2."
    echo -e " ${yellow}+ Step 2${dull}:"
    echo " If you want to download packages (and why wouldn't you?), the easiest way"
    echo " is to prepare a simple text file containing the names of the packages you"
    echo " want, one on each line. Run ALPPS with the option \"fetch <filename>\" and"
    echo " sit back and wait until it's done. Don't worry about dependencies: ALPPS"
    echo " handles them automatically."
    echo -e " ${yellow}+ Step 2 alt${dull}:"
    echo " As a convenience, \"fetch full\" will download all the packages needed to"
    echo " update the offline box."
    echo -e " ${yellow}+ Step 3${dull}:"
    echo " Finally, back on your offline box, run ALPPS again with the \"install\""
    echo " option. This will update the package list and copy the package files into"
    echo " local cache. You can now run \"pacman -S <package names>\" to finish"
    echo " installing the packages."
    # ALPPS no longer installs the packages, just caches them locally.
    # Not entirely sure why; it just felt too klutzy.
    echo -e " ${yellow}+ Step 4${dull}:"
    echo " You will now probably want to delete all the stuff you no longer need. Run"
    echo " ALPPS with the option \"clean\". This won't touch your request file(s). It"
    echo -e " ${red}WILL${dull} delete log files, so if you want to keep them, back them up first."
    echo " Next time you do this, don't forget to run ALPPS with \"init\" again."
    echo
    bugs)
    echo
    echo -e " ${green}Where this goes wrong${dull}"
    echo -e " ${green}=====================${dull}"
    echo " + ALPPS is a bit slow when packages have many dependencies. It's a recursive"
    echo " shell script: what did you expect?"
    echo " + It only uses the settings in /etc/pacman.conf. If your conf file is"
    echo " elsewhere, you're SOL. Similarly, the repositories are all taken from"
    echo " /etc/pacman.d/mirrorlist. If you added any custom repositories in"
    echo " /etc/pacman.conf (or any other file), ALPPS ignores them."
    echo " + As it stands, ALPPS only works when the proxy box has bash, wget, sed,"
    echo " grep and tar installed. The offline box needs bash, pacman and sed (in"
    echo " theory, this shouldn't be a problem...)."
    echo " + There is as yet no way of handling package groups, short of listing every"
    echo " member of the group."
    echo " + I don't think ALPPS will ever be able to handle AUR packages. Of course, if"
    echo " you're compiling AUR packages, you probably won't need something like this!"
    echo
    faq)
    echo
    echo -e " ${green}Frequently Asked Questions${dull}"
    echo -e " ${green}==========================${dull}"
    echo
    echo -e " ${red}Q:${dull} Can I run the whole thing off a USB stick?"
    echo -e " ${lblue}A:${dull} Certainly."
    echo
    echo -e " ${red}Q:${dull} Can I use a non-POSIX computer as a proxy (e.g. Windows)?"
    echo -e " ${lblue}A:${dull} Probably not, unless that computer has a POSIX-compatibility layer"
    echo " installed (such as Cygwin) with bash, wget, tar, sed and grep."
    echo
    echo -e " ${red}Q:${dull} Do I need to download the package list, waste time updating my computer,"
    echo " then go back again to download the packages I want?"
    echo -e " ${lblue}A:${dull} Nope! You can update the packagelist database and download piping-hot"
    echo " fresh packages, all in one sitting."
    echo -e " ${red}Q:${dull} You mean I won't have to futz around with package lists that keep updating"
    echo " ten minutes after I download them?"
    echo -e " ${lblue}A:${dull} Exactly. Nice, isn't it?"
    echo
    echo -e " ${red}Q:${dull} Does this thing handle SSL and signed packages?"
    echo -e " ${lblue}A:${dull} ALPPS uses SSL if:"
    echo " - the mirror has an https address (at present, none do), and"
    echo " - wget on the proxy box is compiled with SSL support"
    echo " Concerning signed packages: no, but then again, it doesn't need to. ALPPS"
    echo " downloads packages; it's pacman's responsibility to verify them. Your"
    echo " system remains safe (or as safe as it ever was, at any rate)."
    echo -e " ${red}Q:${dull} What about gpg keys? I need to get them."
    echo -e " ${lblue}A:${dull} ...maybe later, say, in version 3."
    echo
    echo -e " ${red}Q:${dull} ALPPS says it \`prepares databases´. Can pacman still use them after this?"
    echo -e " ${lblue}A:${dull} Yes, it can. In fact, what ALPPS does is extract the databases into a"
    echo " temp directory, without altering the original .db files."
    echo
    echo -e " ${red}Q:${dull} Where can I contact you?"
    echo -e " ${lblue}A:${dull} For constructive, useful questions and comments: [email protected] and"
    echo " be sure to mention Arch Linux in the subject."
    echo " For flames, trolling, spam and the like, visit your local bitbucket."
    echo
    todo)
    echo
    echo -e " ${green}What's next?${dull}"
    echo -e " ${green}============${dull}"
    echo -e " + I ${red}might${dull} be able to extend the reach of this thing to the AUR."
    echo " Yes, I know I said ALPPS couldn't (in \"bugs\"), but I've learned"
    echo " something new since then. It'll be tricky, though, since the AUR web"
    echo " interface delivers results in python. While this should be a Good Thing,"
    echo " bash isn't very good at handling python-format lists and dicts."
    echo
    -v|ver|version|--ver|--version)
    echo -e "${lgreen}Arch Linux pacman proxy script${dull} | ${yellow}version $VER${dull}"
    dl_list) # Debugging
    (( DEBUG == 0 )) && echo "the \"dl_list\" option is only for debugging" && exit 0
    arch=$(<.temp-alpps/snapshot.architecture)
    unset download_files
    unset download_array
    declare -A download_array
    find_dependencies $2
    bugspray "Download list: $download_files" 3
    echo "Download list v2:"
    for x in $download_files ; do
    bugspray " File \"$x\" from repo \"${download_array[$x]}\"" 3
    echo " Full URL: http://mirror.archlinux.org/${download_array[$x]}/os/$arch/$x" ; done
    verint) # Debugging
    (( DEBUG == 0 )) && echo "the \"verint\" option is only for debugging" && exit 0
    for x in `ls .temp-alpps/*/$2-*/desc` ; do
    packagename=`sed -r '/%NAME%/,+1!d;/%NAME%/d' $x`
    if [[ j$packagename == j$2 ]] ; then
    bugspray "Unique package-name file found: $packagename=$2" 2
    distantversion=`sed '/%VERSION%/,+1!d;/%VERSION%/d' $x`
    dlfile=`sed '/%FILENAME%/,+1!d;/%FILENAME%/d' $x`
    package_full=$packagename-$distantversion
    the_repo=`echo $x|sed -r 's/.temp-alpps\/(.*)\.db.*/\1/'`
    the_path=`echo $x|sed -r 's/desc//'`
    local_version=`sed -r '/^'$packagename' /!d;s/.* //' .temp-alpps/snapshot.state`
    break ; fi ; done
    echo "full package filename: $dlfile"
    echo "Comparing local ($local_version) and distant ($distantversion) versions of $2..."
    compare_versions $local_version $distantversion
    #compare_versions 2.5beta3-2 2.5cvs4-1
    echo "...and the verdict is: $update"
    init)
    x=`uname -m`
    if [[ -x /usr/bin/pacman ]] ; then
    [[ -d .temp-alpps ]] || mkdir .temp-alpps/
    pacman -Q>.temp-alpps/snapshot.state
    sed -r '/^Se/!d;s/Server = //' /etc/pacman.d/mirrorlist>.temp-alpps/snapshot.mirrorlist
    sed -r '/^\[/!d;/options/d;s/\[(.*)\]/\1/' /etc/pacman.conf>.temp-alpps/snapshot.repositories
    sed -r '/^Architecture/!d;s/^.*= //' /etc/pacman.conf>.temp-alpps/snapshot.architecture
    [[ ! -s .temp-alpps/snapshot.architecture || auto == $(<.temp-alpps/snapshot.architecture) ]] && $x>.temp-alpps/snapshot.architecture
    sed -r '/^SyncFirst/!d;s/.*= //;s/ /\n/g' /etc/pacman.conf>.temp-alpps/snapshot.prioritypackages
    echo "Current state recorded."
    else
    echo "You seem to be running ALPPs on an unsupported system."
    echo "ALPPS is the ${lgreen}Arch Linux Pacman Proxy Script${dull} and simply"
    echo "won't run properly on a non-pacman OS (except when proxying)."
    echo "Aborting. Sorry."
    exit 1 ; fi
    fetchdb)
    [[ -d downloads ]] || mkdir downloads
    arch=$(<.temp-alpps/snapshot.architecture)
    declare -A download_array
    for repo in $(<.temp-alpps/snapshot.repositories) ; do
    download_array[${repo}.db]=$repo
    location="${repo}.db"
    failover_fetch $location ; done
    if [[ j$2 != jsimple ]] ; then
    [[ -d log-alpps ]] || mkdir log-alpps
    [[ -a syncfirst ]] && rm -f syncfirst
    echo "Preparing databases for local processing. This might take a while."
    for x in $(<.temp-alpps/snapshot.repositories) ; do
    echo "Preparing $x.db"
    if [[ -a downloads/$x.db ]] ; then
    [[ -d .temp-alpps/$x.db ]] || mkdir .temp-alpps/$x.db/
    tar -xzC .temp-alpps/$x.db/ -f downloads/$x.db --transform 's/:/§/' --no-same-owner && echo "$x database ready for use."
    else
    echo -e "Database $x.db is missing. Skipping. This will probably cause problems." ; fi ; done
    # SyncFirst package warning
    [[ -z $download_list ]] || unset download_list
    [[ -a syncfirst ]] && rm -f syncfirst
    for x in $(<.temp-alpps/snapshot.prioritypackages) ; do
    find_dependencies $x ; done
    bugspray "download_files: $download_files" 2
    if [[ ! -z $download_files ]] ; then
    echo "New version(s) of SyncFirst package(s):"
    for x in $(<.temp-alpps/snapshot.prioritypackages) ; do
    [[ ! -z `echo $download_files|grep $x` ]] && echo "- $x" && echo $x>>syncfirst ; done
    echo "Package names placed in 'syncfirst'. Don't forget to download them!" ; fi ; fi
    fetch)
    for x in $(<.temp-alpps/snapshot.repositories) ; do
    if ! [[ -d .temp-alpps/$x.db/ ]] ; then
    bugspray "You must first download a fresh database with the \"fetchdb\" option" 0
    exit 1 ; fi ; done
    arch=$(<.temp-alpps/snapshot.architecture)
    unset download_array
    declare -A download_array
    unset download_files
    if [[ $2 == full ]] ; then
    echo " Building full upgrade list. This will almost certainly take a while."
    echo " Please wait..."
    for y in `sed -r 's/^(.*) .*/\1/' .temp-alpps/snapshot.state` ; do
    bugspray "Examining $y" 1
    find_dependencies $y ; done
    elif [[ -a $2 ]] ; then
    echo " Determining dependencies. This might take a while. Please wait."
    for y in $(<$2) ; do
    bugspray "Examining $y" 1
    find_dependencies $y ; done
    else
    echo " Error: you should provide a list-file or the keyword \"full\"."
    echo " (see 'alpps.sh howto', step 2)"
    exit 1 ; fi
    if [[ -z $download_files ]] ; then
    echo " No files to download: either none found, or all found are up to date."
    else
    [[ -d downloads ]] || mkdir downloads
    for x in $download_files ; do
    failover_fetch $x ; done ; fi
    install)
    dbpath=`sed -r '/^DBPath/!d;s/^.*= //' /etc/pacman.conf`
    [[ -z $dbpath ]] && dbpath="/var/lib/pacman/"
    bugspray "dbpath: $dbpath" 2
    echo " Updating databases"
    cp -ft ${dbpath}sync/ downloads/*.db
    cachedir=`sed -r '/^CacheDir/!d;s/^.*= //' /etc/pacman.conf`
    [[ -z $cachedir ]] && cachedir="/var/cache/pacman/pkg/"
    echo " Caching packages"
    cp -f downloads/*.pkg.tar.xz $cachedir
    echo
    echo " Don't forget to install/update your packages."
    echo " Exercise proper caution."
    echo " Have fun!"
    clean)
    echo "Cleaning up. This might take a while."
    rm -fr .temp-alpps/ && echo "Buffer directory deleted" || echo "Problem deleting buffer directory '.temp-alpps/'"
    rm -fr log-alpps/ && echo "Log directory deleted" || echo "Problem deleting 'log-alpps/'"
    rm -fr downloads/ && echo "Downloaded packages deleted" || echo "Problem deleting 'downloads/'"
    echo
    echo -e " ${lgreen}Arch Linux pacman proxy script${dull}"
    echo
    echo -e " ${green}Description${dull}"
    echo -e " ${green}===========${dull}"
    echo -e " This is a bash script to fetch and install packages for an offline Arch box"
    echo " using another, online box as a proxy of sorts. So far, this only works if"
    echo " the proxy box has bash, wget, tar, sed and grep installed."
    echo " It's probably also entirely unsafe, incompatible and will destroy your box"
    echo " in a fiery blaze if you try to use it (you know the drill)."
    echo
    echo -e " ${green}Options${dull}"
    echo -e " ${green}=======${dull}"
    echo " init Step 0 (as it were): take a snapshot of your system"
    echo " fetchdb Step 1: download the packagelist database"
    echo " fetch <file> Step 2: download requested packages"
    echo " install Step 3: update your system"
    echo " clean Step 4: delete any unneeded files"
    echo
    echo " howto More detailed instructions"
    echo " bugs Problems and future plans"
    echo " faq As it says"
    echo " warranty (in case it ever becomes necessary)"
    echo " version (to be honest, I wasn't expecting to go beyond v1-rc or so)"
    echo " help You're reading it, doofus :^)"
    echo
    # dl_list Test the find_dependencies function"
    # verint Test the compare_versions function"
    esac

    AnimaInvicta wrote:
    Since my Arch box has no internet connection (yes, I'm that much of a masochist), I wrote a bash script to act as a proxy of sorts for pacman, at least as regards downloading. It took a while to get it working (intermittent web access and all) but here it finally is, as promised.
    It works well for me, and I only hope that it will help anyone else in the same situation (if there is anyone else in the same situation).
    The script has various options to explain everything you need to know, but here's a quick word of warning: it only works on POSIX-compatible computers (i.e. no Wintendows, usually) and the proxy box needs to have bash, wget, tar, grep and sed installed. I don't see this as being a problem, but if I'm wrong, tell me all about it.
    #!/bin/bash
    readonly VER="2.1"
    readonly wgetVER=`wget -V|sed '1!d'`
    # DEBUG levels:
    # Set to 0 for ALERT-level messages only
    # Set to 1 for INFO-level messages (I prefer this)
    # Set to 2 for DEBUG-level messages
    # Set to 3 for all messages
    readonly DEBUG=0
    # Set DEBUGLOG=1 to print ALERT, INFO and DEBUG messages to DEBUG.log
    readonly DEBUGLOG=0
    readonly COLOUR=true
    if [[ $COLOUR == true ]] ; then
    readonly red='\e[31m'
    readonly warn='\e[31;7m '
    readonly green='\e[32m'
    readonly lgreen='\e[32;1m'
    readonly yellow='\e[33;1m'
    readonly lblue='\e[34;1m'
    readonly dull='\e[0m' ; fi
    # Sticky details:
    # tar seems very slow (vfat? transform? USB?)
    function bugspray {
    [[ -z $2 ]] && verbosity=1 || verbosity=$2
    if (( DEBUG >= verbosity )) ; then
    (( $2 == 0 )) && intro="${warn}ALERT${dull} | "
    (( $2 == 1 )) && intro=" INFO | "
    (( $2 > 1 )) && intro=" ${yellow}DEBUG${dull} | "
    echo -e "$intro$1"
    (( DEBUGLOG == 1 )) && echo "`date +%F_%T` | $1">>log-alpps/DEBUG.log ; fi ; }
    function compare_versions {
    # Requires two ordinary, untweaked version strings, first local, second distant
    if [[ -z $2 ]] ; then
    bugspray "compare_versions didn't receive two variables." 2 ; fi
    update='no'
    [[ -z $2 ]] && return
    local localversion=(`echo $1|sed -r 's/([[:alpha:]]+)/ \1 /g;s/[\.:~_-]/ /g'`)
    local distantversion=(`echo $2|sed -r 's/([[:alpha:]]+)/ \1 /g;s/[\.:~_-]/ /g'`)
    local max=$((${#distantversion[*]}))
    bugspray "localversion: ${localversion[*]}; distantversion: ${distantversion[*]}" 2
    for (( x=0 ; (( x < $max )) ; $((x++)) )) ; do
    bugspray "local version part: `echo ${localversion[$x]}` | distant version part: `echo ${distantversion[$x]}`" 2
    if [[ `echo ${localversion[$x]}|grep -E '^[0-9]*$'` && `echo ${distantversion[$x]}|grep -E '^[0-9]*$'` ]] ; then
    bugspray "Numerical comparison" 2
    bugspray "localver (${localversion[$x]}) less than distantver (${distantversion[$x]}): $(( 10#${localversion[$x]} < 10#${distantversion[$x]} ))" 3
    # Different compare methods for numbers, single letters and multiple letters.
    if (( 10#${localversion[$x]} < 10#${distantversion[$x]} )) ; then
    update='yes'
    break ; fi ; fi
    if [[ `echo ${localversion[$x]}|grep -E '^[[:alpha:]]$'` && `echo ${distantversion[$x]}|grep -E '^[[:alpha:]]$'` ]] ; then # single letter -> compare
    bugspray "Lexicographical comparison" 2
    bugspray "localver (${localversion[$x]}) less than distantver (${distantversion[$x]}): [[ ${localversion[$x]} < ${distantversion[$x]} ]]" 3
    if [[ ${localversion[$x]} < ${distantversion[$x]} ]] ; then
    update='yes'
    break ; fi ; fi
    if [[ `echo ${localversion[$x]}|grep -E '^[[:alpha:]]+$'` && `echo ${distantversion[$x]}|grep -E '^[[:alpha:]]+$'` ]] ; then # string -> drop
    # cvs / git / beta -> what are the rules?
    bugspray "Sequence of letters. Not treating as version number." 2 ; fi
    done ; }
    function find_dependencies {
    # Determine existence via unique path
    bugspray "+ ${lgreen}Building download list for package \"$1\"${dull}" 1
    local packagename
    local dlfile
    local package_found=no
    if [[ `ls .temp-alpps/*.db/$1-* 2>/dev/null` ]] ; then
    bugspray "Analogous package-name file(s) found" 2
    for x in `ls .temp-alpps/*.db/$1-*/desc` ; do
    bugspray "Checking $x" 2
    packagename=`sed -r '/%NAME%/,+1!d;/%NAME%/d' $x`
    if [[ j$packagename == j$1 ]] ; then
    bugspray "Exact match found: $packagename = $1" 2
    dlfile=`sed '/%FILENAME%/,+1!d;/%FILENAME%/d' $x`
    local distantversion=`sed '/%VERSION%/,+1!d;/%VERSION%/d' $x`
    local package_full=$packagename-$distantversion
    local the_repo=`echo $x|sed -r 's/.temp-alpps\/(.*)\.db.*/\1/'`
    local the_path=`echo $x|sed -r 's/desc//'`
    unplus=`echo $packagename|sed 's/\+/\\\+/g'`
    local local_version=`sed -r '/^'$unplus' /!d;s/.* //' .temp-alpps/snapshot.state`
    package_found=yes
    break ; fi ; done ; fi
    if [[ -z $dlfile ]] ; then
    bugspray "Exact match not found -> looking for replacements." 2
    if ! [[ -z `grep $1 .temp-alpps/*.db/*/depends` ]] ; then
    local provisional=`grep $1 .temp-alpps/*.db/*/depends|sed -r 's/\/depends.*//'`
    for package in $provisional ; do
    local providence=`sed -r '/%PROVIDES%/,/^$/!d;/%PROVIDES%/d;/^$/d;s/>.*//;s/=.*//' $package/depends`
    for y in $providence ; do
    if [[ j$y == j$1 ]] ; then
    # But what about when several packages provide the same thing and ALPPS picks the wrong one? Can it happen?
    local newdep=`sed -r '/%NAME%/,+1!d;/%NAME%/d' $package/desc`
    bugspray " -> Package \"$newdep\" provides \"$1\"." 1
    find_dependencies $newdep
    break 2 ; fi ; done ; done
    if [[ -z $newdep ]] ; then
    bugspray "${warn}Warning:${dull} package \"$1\" not found in database." 0 ; fi ; fi ; fi
    bugspray "package: $1 | package_found = $package_found" 2
    # Add file to download_list if not up to date and if not already present
    if [[ j$package_found == jyes ]] ; then
    local already_got_one=no
    unplus=`echo $dlfile|sed 's/\+/\\\+/g'`
    [[ `echo $download_files|grep $unplus` ]] && already_got_one="yes" && bugspray "${green}Package in queue${dull}" 1
    [[ `ls downloads/$dlfile 2>/dev/null` ]] && already_got_one="yes" && bugspray "${green}Package proxied${dull}" 1
    compare_versions $local_version $distantversion
    bugspray "compare_versions says: $update" 2
    ! [[ -z $local_version || $update == yes ]] && already_got_one="yes" && bugspray "${green}Package already installed and up-to-date${dull}" 1
    if [[ j$already_got_one != jyes ]] ; then
    bugspray "${green}Confirm downloading${dull}" 1
    download_files+="$dlfile "
    download_array[${dlfile}]=$the_repo
    bugspray "Checking for further dependencies" 2
    if [[ -a $the_path/depends && `grep -E '^%DEPENDS%$' $the_path/depends` ]] ; then
    local dependency=`sed -r '/%DEPENDS%/d;/^$/q' $the_path/depends`
    bugspray "Dependencies of \"$packagename\":$dependency" 3
    for x in $dependency ; do
    # Is this dependency already installed? Sort-of the same as higher up; it just saves time here.
    local depname=`echo $x|sed -r 's/>.*//;s/=.*//'`
    local depminver=`echo $x|sed -r 's/.*>//'`
    bugspray "Dependency name: \"$depname\"" 2
    if ! [[ `grep -E '^$depname ' .temp-alpps/snapshot.state` ]] ; then
    find_dependencies $depname ; fi ; done
    else
    bugspray "${lblue}End of the line${dull}: package \"$packagename\" has no dependencies." 2
    true ; fi ; fi ; fi ; }
    function failover_fetch {
    echo "Downloading `echo $1|sed 's/.*\///'`"
    [[ -d log-alpps/ ]] || mkdir log-alpps/
    [[ -z $success ]] || unset success
    for mirror in $(<.temp-alpps/snapshot.mirrorlist) ; do
    # If DEBUG>0, shouldn't redirect output
    url=`echo $mirror|sed 's/$arch/'$arch'/;s/$repo/'${download_array[$1]}'/'`/$1
    bugspray "Connecting to $url" 2
    wget -o .temp-alpps/very-temp-log -U "Arch Linux Pacman Proxy Script version $VER / $wgetVER" -P downloads/ $url && success=true
    cat .temp-alpps/very-temp-log>>log-alpps/download.log
    rm -f .temp-alpps/very-temp-log
    if [[ -n $success ]] ; then
    bugspray "Download: \$success = true" 2
    break ; fi ; done
    if [[ -z $success ]] ; then
    bugspray "${warn}FAIL:${dull} $1 not accessible on known mirrors." 0 ; fi ; }
    case $1 in
    warranty)
    echo
    echo -e " ${green}Warranty${dull}"
    echo -e " ${green}========${dull}"
    echo " This program is free software. It comes without any warranty, to"
    echo " the extent permitted by applicable law. You can redistribute it"
    echo " and/or modify it under the terms of the Do What The Fuck You Want"
    echo " To Public License, Version 2, as published by Sam Hocevar. See"
    echo " http://sam.zoy.org/wtfpl/COPYING for more details."
    echo
    howto)
    echo
    echo -e " ${green}How to use ALPPS${dull}"
    echo -e " ${green}================${dull}"
    echo -e " ${yellow}+ Step 0${dull}: prime the engine"
    echo " On your offline box, copy the ALPPS script onto a removable medium, cd into"
    echo " it's directory, then run it with the \"init\" option. This essentially"
    echo " takes a snapshot of your system, package-wise. Your removable medium is"
    echo " now ready for use!"
    echo -e " ${yellow}+ Step 1${dull}:"
    echo " On the proxy box the first order of business is to download and decompress"
    echo " the current package lists. You can do this with the \"fetchdb\" option."
    echo -e " ${yellow}+ Step 1 alt${dull}:"
    echo " If you want to download the package lists without decompressing them,"
    echo " \"fetchdb simple\" will do this. It's a lot quicker, but please keep"
    echo " in mind that you cannot then do anything in step 2."
    echo -e " ${yellow}+ Step 2${dull}:"
    echo " If you want to download packages (and why wouldn't you?), the easiest way"
    echo " is to prepare a simple text file containing the names of the packages you"
    echo " want, one on each line. Run ALPPS with the option \"fetch <filename>\" and"
    echo " sit back and wait until it's done. Don't worry about dependencies: ALPPS"
    echo " handles them automatically."
    echo -e " ${yellow}+ Step 2 alt${dull}:"
    echo " As a convenience, \"fetch full\" will download all the packages needed to"
    echo " update the offline box."
    echo -e " ${yellow}+ Step 3${dull}:"
    echo " Finally, back on your offline box, run ALPPS again with the \"install\""
    echo " option. This will update the package list and copy the package files into"
    echo " local cache. You can now run \"pacman -S <package names>\" to finish"
    echo " installing the packages."
    # ALPPS no longer installs the packages, just caches them locally.
    # Not entirely sure why; it just felt too klutzy.
    echo -e " ${yellow}+ Step 4${dull}:"
    echo " You will now probably want to delete all the stuff you no longer need. Run"
    echo " ALPPS with the option \"clean\". This won't touch your request file(s). It"
    echo -e " ${red}WILL${dull} delete log files, so if you want to keep them, back them up first."
    echo " Next time you do this, don't forget to run ALPPS with \"init\" again."
    echo
    bugs)
    echo
    echo -e " ${green}Where this goes wrong${dull}"
    echo -e " ${green}=====================${dull}"
    echo " + ALPPS is a bit slow when packages have many dependencies. It's a recursive"
    echo " shell script: what did you expect?"
    echo " + It only uses the settings in /etc/pacman.conf. If your conf file is"
    echo " elsewhere, you're SOL. Similarly, the repositories are all taken from"
    echo " /etc/pacman.d/mirrorlist. If you added any custom repositories in"
    echo " /etc/pacman.conf (or any other file), ALPPS ignores them."
    echo " + As it stands, ALPPS only works when the proxy box has bash, wget, sed,"
    echo " grep and tar installed. The offline box needs bash, pacman and sed (in"
    echo " theory, this shouldn't be a problem...)."
    echo " + There is as yet no way of handling package groups, short of listing every"
    echo " member of the group."
    echo " + I don't think ALPPS will ever be able to handle AUR packages. Of course, if"
    echo " you're compiling AUR packages, you probably won't need something like this!"
    echo
    faq)
    echo
    echo -e " ${green}Frequently Asked Questions${dull}"
    echo -e " ${green}==========================${dull}"
    echo
    echo -e " ${red}Q:${dull} Can I run the whole thing off a USB stick?"
    echo -e " ${lblue}A:${dull} Certainly."
    echo
    echo -e " ${red}Q:${dull} Can I use a non-POSIX computer as a proxy (e.g. Windows)?"
    echo -e " ${lblue}A:${dull} Probably not, unless that computer has a POSIX-compatibility layer"
    echo " installed (such as Cygwin) with bash, wget, tar, sed and grep."
    echo
    echo -e " ${red}Q:${dull} Do I need to download the package list, waste time updating my computer,"
    echo " then go back again to download the packages I want?"
    echo -e " ${lblue}A:${dull} Nope! You can update the packagelist database and download piping-hot"
    echo " fresh packages, all in one sitting."
    echo -e " ${red}Q:${dull} You mean I won't have to futz around with package lists that keep updating"
    echo " ten minutes after I download them?"
    echo -e " ${lblue}A:${dull} Exactly. Nice, isn't it?"
    echo
    echo -e " ${red}Q:${dull} Does this thing handle SSL and signed packages?"
    echo -e " ${lblue}A:${dull} ALPPS uses SSL if:"
    echo " - the mirror has an https address (at present, none do), and"
    echo " - wget on the proxy box is compiled with SSL support"
    echo " Concerning signed packages: no, but then again, it doesn't need to. ALPPS"
    echo " downloads packages; it's pacman's responsibility to verify them. Your"
    echo " system remains safe (or as safe as it ever was, at any rate)."
    echo -e " ${red}Q:${dull} What about gpg keys? I need to get them."
    echo -e " ${lblue}A:${dull} ...maybe later, say, in version 3."
    echo
    echo -e " ${red}Q:${dull} ALPPS says it \`prepares databases´. Can pacman still use them after this?"
    echo -e " ${lblue}A:${dull} Yes, it can. In fact, what ALPPS does is extract the databases into a"
    echo " temp directory, without altering the original .db files."
    echo
    echo -e " ${red}Q:${dull} Where can I contact you?"
    echo -e " ${lblue}A:${dull} For constructive, useful questions and comments: [email protected] and"
    echo " be sure to mention Arch Linux in the subject."
    echo " For flames, trolling, spam and the like, visit your local bitbucket."
    echo
    todo)
    echo
    echo -e " ${green}What's next?${dull}"
    echo -e " ${green}============${dull}"
    echo -e " + I ${red}might${dull} be able to extend the reach of this thing to the AUR."
    echo " Yes, I know I said ALPPS couldn't (in \"bugs\"), but I've learned"
    echo " something new since then. It'll be tricky, though, since the AUR web"
    echo " interface delivers results in python. While this should be a Good Thing,"
    echo " bash isn't very good at handling python-format lists and dicts."
    echo
    -v|ver|version|--ver|--version)
    echo -e "${lgreen}Arch Linux pacman proxy script${dull} | ${yellow}version $VER${dull}"
    dl_list) # Debugging
    (( DEBUG == 0 )) && echo "the \"dl_list\" option is only for debugging" && exit 0
    arch=$(<.temp-alpps/snapshot.architecture)
    unset download_files
    unset download_array
    declare -A download_array
    find_dependencies $2
    bugspray "Download list: $download_files" 3
    echo "Download list v2:"
    for x in $download_files ; do
    bugspray " File \"$x\" from repo \"${download_array[$x]}\"" 3
    echo " Full URL: http://mirror.archlinux.org/${download_array[$x]}/os/$arch/$x" ; done
    verint) # Debugging
    (( DEBUG == 0 )) && echo "the \"verint\" option is only for debugging" && exit 0
    for x in `ls .temp-alpps/*/$2-*/desc` ; do
    packagename=`sed -r '/%NAME%/,+1!d;/%NAME%/d' $x`
    if [[ j$packagename == j$2 ]] ; then
    bugspray "Unique package-name file found: $packagename=$2" 2
    distantversion=`sed '/%VERSION%/,+1!d;/%VERSION%/d' $x`
    dlfile=`sed '/%FILENAME%/,+1!d;/%FILENAME%/d' $x`
    package_full=$packagename-$distantversion
    the_repo=`echo $x|sed -r 's/.temp-alpps\/(.*)\.db.*/\1/'`
    the_path=`echo $x|sed -r 's/desc//'`
    local_version=`sed -r '/^'$packagename' /!d;s/.* //' .temp-alpps/snapshot.state`
    break ; fi ; done
    echo "full package filename: $dlfile"
    echo "Comparing local ($local_version) and distant ($distantversion) versions of $2..."
    compare_versions $local_version $distantversion
    #compare_versions 2.5beta3-2 2.5cvs4-1
    echo "...and the verdict is: $update"
    init)
    x=`uname -m`
    if [[ -x /usr/bin/pacman ]] ; then
    [[ -d .temp-alpps ]] || mkdir .temp-alpps/
    pacman -Q>.temp-alpps/snapshot.state
    sed -r '/^Se/!d;s/Server = //' /etc/pacman.d/mirrorlist>.temp-alpps/snapshot.mirrorlist
    sed -r '/^\[/!d;/options/d;s/\[(.*)\]/\1/' /etc/pacman.conf>.temp-alpps/snapshot.repositories
    sed -r '/^Architecture/!d;s/^.*= //' /etc/pacman.conf>.temp-alpps/snapshot.architecture
    [[ ! -s .temp-alpps/snapshot.architecture || auto == $(<.temp-alpps/snapshot.architecture) ]] && $x>.temp-alpps/snapshot.architecture
    sed -r '/^SyncFirst/!d;s/.*= //;s/ /\n/g' /etc/pacman.conf>.temp-alpps/snapshot.prioritypackages
    echo "Current state recorded."
    else
    echo "You seem to be running ALPPs on an unsupported system."
    echo "ALPPS is the ${lgreen}Arch Linux Pacman Proxy Script${dull} and simply"
    echo "won't run properly on a non-pacman OS (except when proxying)."
    echo "Aborting. Sorry."
    exit 1 ; fi
    fetchdb)
    [[ -d downloads ]] || mkdir downloads
    arch=$(<.temp-alpps/snapshot.architecture)
    declare -A download_array
    for repo in $(<.temp-alpps/snapshot.repositories) ; do
    download_array[${repo}.db]=$repo
    location="${repo}.db"
    failover_fetch $location ; done
    if [[ j$2 != jsimple ]] ; then
    [[ -d log-alpps ]] || mkdir log-alpps
    [[ -a syncfirst ]] && rm -f syncfirst
    echo "Preparing databases for local processing. This might take a while."
    for x in $(<.temp-alpps/snapshot.repositories) ; do
    echo "Preparing $x.db"
    if [[ -a downloads/$x.db ]] ; then
    [[ -d .temp-alpps/$x.db ]] || mkdir .temp-alpps/$x.db/
    tar -xzC .temp-alpps/$x.db/ -f downloads/$x.db --transform 's/:/§/' --no-same-owner && echo "$x database ready for use."
    else
    echo -e "Database $x.db is missing. Skipping. This will probably cause problems." ; fi ; done
    # SyncFirst package warning
    [[ -z $download_list ]] || unset download_list
    [[ -a syncfirst ]] && rm -f syncfirst
    for x in $(<.temp-alpps/snapshot.prioritypackages) ; do
    find_dependencies $x ; done
    bugspray "download_files: $download_files" 2
    if [[ ! -z $download_files ]] ; then
    echo "New version(s) of SyncFirst package(s):"
    for x in $(<.temp-alpps/snapshot.prioritypackages) ; do
    [[ ! -z `echo $download_files|grep $x` ]] && echo "- $x" && echo $x>>syncfirst ; done
    echo "Package names placed in 'syncfirst'. Don't forget to download them!" ; fi ; fi
    fetch)
    for x in $(<.temp-alpps/snapshot.repositories) ; do
    if ! [[ -d .temp-alpps/$x.db/ ]] ; then
    bugspray "You must first download a fresh database with the \"fetchdb\" option" 0
    exit 1 ; fi ; done
    arch=$(<.temp-alpps/snapshot.architecture)
    unset download_array
    declare -A download_array
    unset download_files
    if [[ $2 == full ]] ; then
    echo " Building full upgrade list. This will almost certainly take a while."
    echo " Please wait..."
    for y in `sed -r 's/^(.*) .*/\1/' .temp-alpps/snapshot.state` ; do
    bugspray "Examining $y" 1
    find_dependencies $y ; done
    elif [[ -a $2 ]] ; then
    echo " Determining dependencies. This might take a while. Please wait."
    for y in $(<$2) ; do
    bugspray "Examining $y" 1
    find_dependencies $y ; done
    else
    echo " Error: you should provide a list-file or the keyword \"full\"."
    echo " (see 'alpps.sh howto', step 2)"
    exit 1 ; fi
    if [[ -z $download_files ]] ; then
    echo " No files to download: either none found, or all found are up to date."
    else
    [[ -d downloads ]] || mkdir downloads
    for x in $download_files ; do
    failover_fetch $x ; done ; fi
    install)
    dbpath=`sed -r '/^DBPath/!d;s/^.*= //' /etc/pacman.conf`
    [[ -z $dbpath ]] && dbpath="/var/lib/pacman/"
    bugspray "dbpath: $dbpath" 2
    echo " Updating databases"
    cp -ft ${dbpath}sync/ downloads/*.db
    cachedir=`sed -r '/^CacheDir/!d;s/^.*= //' /etc/pacman.conf`
    [[ -z $cachedir ]] && cachedir="/var/cache/pacman/pkg/"
    echo " Caching packages"
    cp -f downloads/*.pkg.tar.xz $cachedir
    echo
    echo " Don't forget to install/update your packages."
    echo " Exercise proper caution."
    echo " Have fun!"
    clean)
    echo "Cleaning up. This might take a while."
    rm -fr .temp-alpps/ && echo "Buffer directory deleted" || echo "Problem deleting buffer directory '.temp-alpps/'"
    rm -fr log-alpps/ && echo "Log directory deleted" || echo "Problem deleting 'log-alpps/'"
    rm -fr downloads/ && echo "Downloaded packages deleted" || echo "Problem deleting 'downloads/'"
    echo
    echo -e " ${lgreen}Arch Linux pacman proxy script${dull}"
    echo
    echo -e " ${green}Description${dull}"
    echo -e " ${green}===========${dull}"
    echo -e " This is a bash script to fetch and install packages for an offline Arch box"
    echo " using another, online box as a proxy of sorts. So far, this only works if"
    echo " the proxy box has bash, wget, tar, sed and grep installed."
    echo " It's probably also entirely unsafe, incompatible and will destroy your box"
    echo " in a fiery blaze if you try to use it (you know the drill)."
    echo
    echo -e " ${green}Options${dull}"
    echo -e " ${green}=======${dull}"
    echo " init Step 0 (as it were): take a snapshot of your system"
    echo " fetchdb Step 1: download the packagelist database"
    echo " fetch <file> Step 2: download requested packages"
    echo " install Step 3: update your system"
    echo " clean Step 4: delete any unneeded files"
    echo
    echo " howto More detailed instructions"
    echo " bugs Problems and future plans"
    echo " faq As it says"
    echo " warranty (in case it ever becomes necessary)"
    echo " version (to be honest, I wasn't expecting to go beyond v1-rc or so)"
    echo " help You're reading it, doofus :^)"
    echo
    # dl_list Test the find_dependencies function"
    # verint Test the compare_versions function"
    esac
    I've always resorted to use VPN, then I started using cntlm, this looks very useful (and a lot of work on your part!) Thanks alot!
    DoctorZeus

Maybe you are looking for

  • Detecting a JDialog opening and closing

    Hey everyone, This is a simple question, or at least, it should be :). I need a Timer to start when a JDialog opens and stop when it closes so a cute icon animation shows. So far, I managed to detect when the window opens, but not when it closes. Thi

  • Problem when load more swf files work with xml files into my movie

    hi ; I have one flash file & more of swf files which work with xml files . when I load one swf file into my flash file  and remove it and load anther one on the same movieclip in my flash file it load the old swf file. when i load one on movieclip an

  • Java 3D problem ...

    I have a problem with java 3d, I would appreciate some help! I use JBuilder 2005. I run Hello3d and it runs ok. its code follows: package untitled1; * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @

  • Will my late 2011 model 13" macbook pro be fine if I put in a bigger mhz memory?

    I bout the wrong memory because I was just in a hurry..blah blah. anyway i need to know if I can use the 1600mhz memory instead of taking it back and having to get the 1333mhz memory. Will there be any resulting factors to the computer because of the

  • E-commerce

    Dear PI team, we are in the process of making sales on our website , for acheiving this i have to flow all the masterdata from ECC  6.0 to the site and also i have to get back all my sales data and custumer info back to ECC kindly let me know what ar