Display IP address in console login screen

2018-04-30 1 min read Learning

Here is one liner that will add the current IP address in the console login screen (if you are not running X as is case for servers):

(ip -o -4 a| awk '$2 !="lo" {print "\nIP Address ::"$4}' |tr '\n' ',';echo)>>/etc/issue

Just execute the above command as root. It will add the required code in “/etc/issue” to display the IP address. BTW, you can also use “\4” or “\6” instead of that command to get the IP but that will not work with some old versions of Linux.

Continue reading

Linked clone with qemu-img

2018-04-09 2 min read Vurtualization

As you would have seen in Virtualbox or vmware, there is option to create a linked clone. I wanted to use the same feature as “Snapshot” feature anyway does not look/work so great with virt-manager. So, I created a script to create a linked clone VM and here it is :

 

#!/bin/bash - 
#===============================================================================
#
#          FILE: qcow2-linked-clone.sh
# 
#         USAGE: ./qcow2-linked-clone.sh 
# 
#   DESCRIPTION: 
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#  ORGANIZATION: Mobileum
#       CREATED: 01/05/2018 09:54
# Last modified: Wed Feb 28, 2018  04:39PM
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error
UP="amitag:amitag" #Here you need to put your username and group.

if [[ $# == 0 ]]
then
    read -p "Enter the source path :: " spath
    read -p "Enter the source disk :: " sdisk
    read -p "Enter the destin path :: " dpath
    read -p "Enter the destin disk :: " ddisk
    read -p "Enter new VMName :: " vmname
else
    spath=$(dirname $1)
    dpath=$spath
    sdisk=$(basename $1)
    ddisk=$2.qcow2
    vmname=$2
fi


sudo chown $UP "$spath/$sdisk"
qemu-img create -f qcow2 -b "$spath/$sdisk" "$dpath/$ddisk"

virt-install --disk $dpath/$ddisk --ram 512 \
    --virt-type kvm --vcpus 1 --name "$vmname" --import

The script will create a linked qcow2 and then create a VM with that image. Running it is simple, either provide command line options or just run and it will ask you for details.

Continue reading

Fix weird flux menu

2017-05-03 1 min read Learning Linux

Some distro’s just add all the items under single menu and thus the menu itself becomes unusable because of the number of items in the submenu and this I did not like and hence ceated this simply python script to fix that. For using the script, back up you “menu” file, redirect the output of this script to ‘menu’ file again.

 

#!/bin/python

F = open("~/.fluxbox/menu", "r")
count=0
mkc=1
started=0

for line in F:
    print line.rstrip()

    if '[submenu]' in line.lower() and started == 1:
        print '[end]'

    if '[end]'  in line.lower():
        count=0
        mkc=1
        if started > 0:
             started=0
             # print "Count is {}".format(count)
             # print "Started is {}".format(started)
             print '[end]'
    if '[exec]'  in line.lower():
        if count > 15 :
            if started > 0:
                started=0
                print '[end]'
                # print "Count is {}".format(count)
                # print "Started is {}".format(started)
            print '[submenu] ({})'.format(mkc)
            started=1
            mkc+=1
            count=0
        # print count
        count+=1

Windows Vs Linux – One more time

2017-04-07 5 min read Linux Uncategorized

Tux, as originally drawn by Larry Ewing
Image via Wikipedia

One of the most written and commented articles has to be Linux vs Windows (of course there are competitors like vim vs emacs) but none has been covered so much as Linux vs Windows. So, what am I going to write here which is not covered earlier in so many other posts. Well a little different perspective 🙂

Continue reading

Celebrating 25 Years of Linux Kernel Development

2017-04-03 9 min read GuestPost Uncategorized

Linux is now 25 years old, but it’s no hipster. It’s not chasing around Pokemon, and it’s not moving back in with its parents due to crippling student debt. In fact, Linux is still growing and evolving, but the core ideas of the Linux State of Mind remain the same.

You see, Linux is much more than an operating system, it’s a mindset. Even if you don’t agree with its philosophy, you can’t afford to ignore it.

Continue reading

flatpak – get latest libreoffice

2017-03-20 1 min read Fedora

flatpak is tool similar to 0install. You can find more details here.

# Get the gnome-sdk gpg keys
wget https://sdk.gnome.org/keys/gnome-sdk.gpg
# Add the keys to trusted keys
flatpak remote-add --user --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/

# Install pre-requisite gnome
flatpak install --user gnome org.gnome.Platform 3.20

# Download the flatpak file and install it. Or you can follow the next step.
wget 'http://download.documentfoundation.org/libreoffice/flatpak/latest/LibreOffice.flatpak'
flatpak install --user --bundle LibreOffice.flatpak

# Install flatpak without downloading
flatpak install --user gnome org.gnome.Platform.Locale 3.20

# Run you brand new shiny latest libreoffice
flatpak run org.libreoffice.LibreOffice

# At a later date, when you want to update libreoffice.
flatpak update --user org.libreoffice.LibreOffice
Older posts Newer posts