[SOLVED] how to detect archlinux from bash ?

Is there any simple way ho to detect from bash it is currently running on Arch? I frequntly usde both arch and debian and want top set up my .bashrc & .nash_profile to be the same on both systems so I need some way how to make some part conditional for arch or debian only.
Last edited by stabele (2009-10-16 12:50:18)

You could look in /etc/. Debian has some specific files /etc/debian-version, /etc/apt/source.list. Archlinux has /etc/arch-release. Unless you keep the same /etc for both of your distrib, that should do the trick. I am not aware of another way to check which distrib the shell is running on.

Similar Messages

  • How to install archlinux from pendrive/usb?

    I downloaded archlinux-2010.05-core-i686.iso.
    I unmounted the pendrive.
    Would i format the pendrive with ext3/ext4 or fat32 or fat16 format?
    After that i would do dd if=archlinux-2010.05-core-i686.iso of=/dev/sda
    If i use unetbootin, should i format the pendrive with ext3/ext4 or fat32 or fat16 format?
    Has anyone used unetbootin to install archlinux from pendrive/usb?

    jasonwryan wrote:I'm pretty sure all of your questions are answered on the wiki: http://wiki.archlinux.org/index.php/Ins … lash_drive
    I did:
    dd if=arch.iso of=/dev/sda
    But after setting bios boot option to usb and reboot,it's not booting from usb.
    What's the problem?
    I get the normal grub menu.
    Last edited by cola (2010-06-17 09:49:34)

  • [SOLVED] How to create array in bash from some lines in config file

    I have config file for small script and it looks like this:
    local_directory="$HOME/etc"
    excluded_directory="$HOME/etc1"
    excluded_directory2="$HOME/etc2"
    excluded_directory3="$HOME/etc3"
    I would like to place all "excluded_directoryXX" config options into array that can be parsed to program. This way i have to hardcode it and it is not practical at all.
    Can somebody help me out?
    Last edited by kuraku (2013-09-24 20:45:42)

    @jasonwryan
    Thank you, i was not aware of that builtin. At first i wanted to use this in combination with "grep --after-context=XX" and then i realized that i can use it this way:
    mapfile -s XX -t configs </etc; echo "${configs[@]}"
    Thank you very much.

  • [SOLVED] how to prevent Xorg from clearing boot messages in scrollback

    I have an updated Arch install with MATE and LightDM. LightDM autologin is enabled, so I normally boot directly to my desktop. I like seeing the messages that flash by during boot, so I deleted the word "quiet" from the linux line in my grub.cfg. Because I want all the messages to still be there after flashing by (in case I want to scroll through them later), I followed the advice here https://wiki.archlinux.org/index.php/Di … t_messages and I also increased the scrollback buffer and enabled early KMS start.
    Despite all the above, I can only scroll back to the beginning of the boot messages if I boot into non-graphical mode (e.g., by adding "systemd.unit=multi-user.target" to GRUB command line). If I allow a normal boot to my destkop and THEN go to non-graphical mode with "sudo systemctl isolate multi-user.target" to look at the boot messages, I notice that I cannot scroll back very far at all--most of the messages that flashed by during boot are gone. Therefore, it seems to me that either lightDM or Xorg is resetting the scrollback buffer and erasing all but the last few boot messages.
    So, how do I tell LightDM or Xorg (whichever one is the culprit) *not* to clear the scrollback buffer, so that when I get out of graphical mode and into non-graphical mode the boot messages are all still there?
    Last edited by bdantas (2014-08-01 14:19:06)

    Since the answer to my original question seems to be "it is not possible," I will make this my last post to prevent the thread from going off-topic.
    I came up with a simple workaround that (almost) recreates the old /var/boot/log:
    1) put "quiet" on grub2's kernel command line so that only* [FAIL] messages show up, so that I don't have to deal with the scrollback buffer
    2) create a startup script with the following contents (script or at least the setterm command must run as root because the setterm command needs to be able to read from /dev/vcs1):
    #!/bin/bash
    # this script will dump the text of tty1 to /var/log/boot, with same formatting as on the screen
    export TERM=xterm
    setterm -dump 1 -file /var/log/boot
    exit 0
    * Unfortunately, even in quiet mode grub2 starts printing all the boot status messages to screen once it encounters a [FAIL]. Therefore, if the [FAIL] occurs early enough in the boot process, the beginning of the messages will scroll off the screen and the workaround won't work. I spun off my two questions related to this nuisance into their own threads:
    a) How to make grub2 actually only print [FAIL] messages during boot? https://bbs.archlinux.org/viewtopic.php?id=184702
    b) How to print the contents of console's scrollback buffer to a file? https://bbs.archlinux.org/viewtopic.php … 9#p1439359
    I hope I can figure out how to do one of the above, because then the workaround would be perfect.
    Thanks for the help, guys!
    Last edited by bdantas (2014-08-15 02:16:38)

  • How to detect malware from the flashlight on iPhone 5?

    I have the factory installed flashlight on my iPhone 5.  I purchased it from the Verizon store.  How can I detect if it really malware?

    Read How can we see if we have malware associated with Flashlight app?

  • [SOLVED] how to install ArchLinux on a simple software raid 0

    I have two 256GB disks and I want them to be in raid 0.
    I tried following this tutorial: https://wiki.archlinux.org/index.php/In … AID_or_LVM
    but this tutorial has the added complication of LVM and raid 1 which I don't need.
    I made 3 partitions on each of the disks:
    sda1 - 100MB for /boot
    sda2 - 2048MB for swap
    sda3 - raid 0 md0
    sdb1 - unused
    sdb2 - 2048 for swap
    sdb3 - raid 0 md0 for /
    I can assemble and format the sda1(ext4), sda2(swap), sdb2(swap)  md0 (ext4) and install all the packages
    I also configured mdadm.conf by Alt F2 at the installer and executing: mdadm --examine --scan > /mnt/etc/mdadm.conf
    and added mdadm hook to the HOOKS list in /etc/mkinitcpio.conf (before 'filesystems')
    configured the boot with grub outside of the installer as indicated in the tutorial
    But when I boot I get:
    md0: unknown partition table
    Error: Unable to determine the file system of /dev/sda3
    please help.
    Last edited by 99Percent (2011-06-29 20:21:52)

    fyi this is how I finally set up my simple 2 drive raid 0:
    1. Create a bootable USB ArchLinux with UNetBootin
    2. Boot with the USB
    3. # /arch/setup
    3. Select source: internet (highly recommended because i found out UNetBootin sources are not 100% reliable though not necessarily so, IOW just to be sure)
    3. partition the two drives with 100mb for /boot and 100mb for swap (setup requires it - I have 8GB memory, I decided I don't need much swap space) and the rest of both sda and sdb which will make your raid 0.
    4. ALT F2 to another terminal and create the the raid like this:
    # modprobe raid0 (not sure if this is actually necessary)
    # mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda2 /dev/sdb2
    5. go back to the setup screen with CTRL-ALT-F1
    6. go to Prepare Hard Drives>Manually configure block devices, filesystems and mountpoints. Add the /boot (ext2) for sda1 swap for sdb1 and desired filesystem for md0 (I chose reiserfs). Ignore the rest of the devices.
    7. Select packages. Add the base-devel just in case, but nothing else and install packages
    8. ALT F2 again to the  terminal and run:
    # mdamd --examine --scan > /mnt/etc/mdadm.conf
    (this will configure the mdadm.conf to use your raid as created)
    9. go back to the setup screen again with CTRL-ALT-F1
    10. Select configure system
    11. Edit /etc/rc.conf adding: raid0 to MODULES= like this:
    MODULES=(raid0)
    again not sure if necessary but it works for me
    12. Edit /etc/mkinitcpio.conf adding dm_mod to the MODULES= like this:
    MODULES="dm_mod"
    13. also add to /etc/mkinitcpio.conf HOOKS= mdadm but before filesystems in my case it went like this:
    HOOKS="base udev autodetect pata scsi sata mdadm filesystems"
    14. I went ahead and uncommented a few mirrors in the mirrorlist file so I wouldn't have to deal with that later (and maybe it helps on the way).
    15. Also set a root password. Not sure if it is even necessary but maybe some components require it.
    16, Go to configure bootloader and select Grub
    17. When asked "Do you have your system installed on software raid? answer Yes
    18. When asked to edit the menu.lst file don't edit anything, just exit
    19. When asked "Do you want to install grub to the MBR of each harddisk from your boot array? answer Yes
    20. You will get "Error: Missing/Invalid root device:" and "GRUB was NOT successfully installed." Ignore those messages.
    21. Exit the install
    22. remove the USB stick and:
    # reboot
    23. the boot will fail and you will get a grub> prompt type the following commands:
    grub> root (hd0,0)
    grub> setup (hd0)
    grub> reboot
    Thats it!
    Last edited by 99Percent (2011-06-28 18:51:59)

  • How to detect OS from within java?

    hi,
    i have a method that reads all the classes in a directory. to do this i use the code
    File dir = new File(DIRECTORY_PATH);
    the variable DIRECTORY_PATH is a windows based directory path and so if i port my app to a mac it will not work 'cos of the different directory structure.
    is there any way i could detect the OS before this method is called so i can change the directory path structure?
    many thanks in advance
    benny

    im reading all the classes available in a dir.
    i then populate a list box with the classes available
    the user can then select the classes he wants created from this list.the code goes something like this:
    File dir = new File(DIRECTORY_PATH);
    String [] classes = dir.list( new FilenameFilter()); //filter gets files ending with .class
    then i populate the list with these, user selects wanted classes and presses create.
    then i use Class.forName() to create the specified classes.
    will this work on both OS? is there a better way to do this if not?

  • [Solved]How to remove files from a failed install.

    I attempted to install the caffeine package from the AUR using packer. After confirming y to proceed with installation pacman had to pull in quite a few more dependencies than I was expecting. The installation ended up failing because I have package signing set to required. This is all well and good because I don't really think caffeine is worth all the extra dependencies. However, on to my question, I see that these packages (the dependencies) have been downloaded to my system and are in the /var/cache/pacman/pkg directory, is there an easy way to tell pacman to remove just these packages other than going through and removing them one by one? Thanks for the help.
    Last edited by Lexworth (2012-01-21 19:19:43)

    Thanks to you all. I did read pacman manpage as well as the wiki entries for pacman and pacman Tips. I was just wondering if maybe someone more proficient with the command line knew a easier way to remove the files. I know I could use pacman -Sc or pacman -Scc for clean the entire cache but was hesitant to do so because of the warnings. I think I understand that sudo pacman -R $(pacman -Qtdq) will remove orphan packages however I get an error that no targets are specified. I believe this may be due to the fact that these packages were not installed, just the binaries downloaded. Thanks again for the help. I'll mark this as solved.

  • How to Install ArchLinux from harddriver???

    I have downloaded iso image files from Internet. I want to install it from hard driver. How to do it? and where are the vmlinuz and initrd files?

    I suppose you can do:
    mount -o loop /path_to_.iso /mnt/cdrom
    but this would have to be  on a secondary HDD otherwise I'm not sure of the outcome, since you would be writing to the same target as your source.
    All files you need will be in the iso.
    R

  • [solved] How to remove color from yaourt output?

    Hi everyone,
    I am having a problem with removing color output from yaourt.
    In order to get a list of installed packages in kdemod-core, I execute the following:
    yaourt -Qs ^kdemod | grep kdemod-core | awk '{print $1}' > kdefiles.txt
    Some time ago colored output was usually lost when piping commands. For some reason it is not removed anymore so that I get the following file content:
    [1;35mkdemod-core/[0m[0m[1mkdemod-kde-common
    [...] and so on
    Of course pacman doesn't understand this anymore:
    pacman -S `cat kdefiles.txt`
    Btw. The same options (-Qs ) with pacman search only locally installed packages.
    Any ideas?
    Thanks,
    David
    Last edited by dcrabs (2009-05-31 10:47:57)

    skottish wrote:
    dcrabs wrote:Btw. The same options (-Qs ) with pacman search only locally installed packages.
    Any ideas?
    pacman -Ss searches on-line.
    Thanks, but then I don't have the packages that are installed. It is of course much faster and without color but doesn't solve my problem.
    Then only thing I could find so far was a statement, that piping through less for example removes color for security reasons. That doesn't seem to be true any more.
    There is a col command which outputs plain text but there are still characters left.

  • [Solved] How do I delete from cursor to beginning of line in Vi?

    I'm wondering if there's a way to delete from the the cursor to the beginning of the current line in Vi, basically doing D backwards.  I would find this very useful, as manually doing this is getting annoying.
    Edit: Of course after days of searching I figure it out right after asking.  It's d0 that I need to type in.
    Last edited by zenten (2012-06-13 17:42:45)

    I saw your thread title and that it was already solved, so I gave myself a little quiz to see if I knew the answer before reading what you wrote.
    Since I use 'd$' to delete to the end of the line, I guessed that it was 'd0' to delete to the beginning of the line. Looks like I was right! Who says Vim isn't intutitive?
    I didn't even know about the 'D' command...

  • [solved] launching rtorrent into urxvt from bash

    I have a bash script running as a deamon and when the time is right it launches my torrents (when I'm asleep)
    It runs perfectly well with terminator and xterm but not with urxvt
    here is the line that calls it
    urxvt -e "rtorrent -o http_capath=/etc/ssl/certs" &
    substitute urxvt for terminator or xterm and it works, urxvt it does not.
    Sad to say I had no new downloads this morning
    Anyone know how to adjust that line so it works?
    Last edited by tawan (2010-04-03 23:33:12)

    It works if you remove the quotes;
    urxvt -e rtorrent -o http_capath=/etc/ssl/certs &
    With the quotes urxvt treats the whole thing as the exec name, for some reason. (Same with screen).

  • [SOLVED] How do I shutdown from SLIM ?

    I am using SLIM to login to Fluxbox.  I should be able to type halt as username from within SLIM to shutdown.  Typing halt as username does not shutdown.  I have set sudo to allow my user to shutdown, but that doesn't help.
    How do I enable shutdown from within SLIM?
    Thank you
    Last edited by glenn69 (2012-04-26 17:49:01)

    glenn69 wrote:I am using SLIM to login to Fluxbox.  I should be able to type halt as username from within SLIM to shutdown.  Typing halt as username does not shutdown.  I have set sudo to allow my user to shutdown, but that doesn't help.
    Does it work with root password?

  • [solved] How to convert fs from ext2 to ext3 on root partition?

    Hello there!
    Edit: It seems that the plan works! apparently it worked for alleyoopster also on a mounted fs.
    As the title says, I want to convert my fs on / from ext2 to ext3. After some research I think I know what
    to do, but want to make sure that I don't mess anything up....
    So here is the plan:
    boot with an install disc and leave the root partition unmounted (I know that in theory the conversion should
    work on a mounted fs, but it feels awkward to me and I want to avoid it....).
    Then use the
    tune2fs -j /dev/xxx
    command (the defaults for the forced checks are ok with me). Then reboot with the CD still in place, but use
    this time root=/dev/xxx. Then I can change my /etc/fstab (ext3 should have been able to be mounted as ext2 at
    the moment). Finally I have to rebuild my initrd image with
    mkinitcpio -p kernel26
    Then I should be able to boot into my system. And now the question: Can anyone verify that this is a valid approach
    and will work? Or knows a better way to do it?
    I'm grateful for any input
    Last edited by alafanky (2007-11-26 15:41:35)

    Have a look at the man for tune2fs and mkinitcpio
    man tune2fs
    man mkinitcpio
    I am looking at doing the same and as far as I can figure out it goes like this, BUT this is not a proven method just what I am thinking of doing, Maybe someone else can correct or add to this or confirm that it will work.
    1. Add journal parameter like this:
    tune2fs -j /dev/sda1
    2. Change the partition type from ext2 to ext3 in /etc/fstab
    3. For a standard  kernel re-create ramdisk with preset parameters (no good for custom kernel)
    mkinitcpio -p kernel26
    As the system is mounted it will create the journal inode in the top level, don't delete this, it will get hidden into the filesystem on reboot.
    Let me know if you make some progress. I may get brave and try it later.
    So in answer, yes pretty much the same but I think you can do it with the fs mounted.
    Last edited by alleyoopster (2007-11-26 12:44:29)

  • [solved]How can I copy from urxvt and paste in firefox?

    I can't copy anything from urxvt to firefox,but I can copy from firefox to urxvt.
    I use fluxbox,anyone can help me?

    zen_guerrilla wrote:
    Add these lines to your .Xdefaults:
    URxvt*perl-ext: default,mark-urls
    URxvt*urlLauncher: firefox
    and source it with xrdb ~/.Xdefaults. Then double-click on the url on urxvt, press Ctrl and right click the url. Select 'run firefox' and you're good to go.
    ...or you can just middle-click the link and it'll open in firefox.

Maybe you are looking for

  • Things to know before building a Mega 651 (and other things you should know afte

    Okay, following hot on the heels of the "things to know" series on Mega 180 and 865, I thought I'd just chip in with this short post on what you should know before splashing out on a nice budget Mega 651 PROCESSOR SUPPORT: The official list of suppor

  • Changing data in Mail adapter

    Hi, I have created receiver Mail adapter for sending PO. XML file, received by mail from XI has slightly changed structure (one or several characters can be changed or missed). I have sent data as attachment and in Mail body - the same result. If I u

  • F5119 - Line item has incorrect Dr/Cr indicator for remaining amount

    Hi Guys, I am trying to execute F-30 transaction and for some cases I got the below message: Message no. F5119: "Line item has incorrect Dr/Cr indicator for remaining amount" All the posting I am posting some value on the residual items. But this sit

  • ICC profiles- iPhoto colour management issues.

    I read in one of the Mac magazines the following regarding the release of iPhoto 5.0.3 ...."images are no longer colour-shifted after editing;....". Does anyone know if this refers to a resolution to the long running problem whereby iPhoto would over

  • How to share ALL pictures in my photostream?

    How to share ALL pictures in my photostream other than by manually marking each picture and every time the photostream gets updated? Thank you.