Wednesday, October 24, 2012

[Android] Flash Android Official ROM without ROOT



ü  Prerequisite : (Warning – This might cause the warranty of product issue)
1.      Nexus Root Toolkit (NRT_v1.5.4.sfx.exe)
2.      PdaNet for Android (pdanetz350.exe - Version 3.50 installer)
3.      Galaxy Nexus Official ROM (takju-jzo54k-factory-92830c0b.tgz)
ps. Version Desc

ü  Procedure :
1.          Install Driver - pdanetz350.exe
2.          Connect Galaxy Nexus to PC (enable usb debug mode)
Setup à Developer options à Turn On à check USB debugging


Figure For step 3,4,5
3.          Choose the Current Version You are using. (Mine is 4.0.4)
4.          Use “Inial Setup” to help you automatically check if there is anything error.
5.          Unlock (Data would be gone in this step and reboot the mobile)
6.          Enable usb debug mode again
7.          Clikc “Flash Stock + Unroot” à Choose the ROM(takju) you just download


8.          Type in the md5 (4e79a918a9a366166d0c23f99cc240db)

9.         Done ! You can now upgrade via OTA from Google !!


Tuesday, October 16, 2012

Linux Package Management - RPM, DPKG


===============================================
dpkg
===============================================
Install Package ---->
-i(--install)
Remove Package---->
-r(--remove)remove totally exluding config file
-p(--purge)  remove totally including config file
Query Package ---->
-l(--list)      list all package
-L packageprint info about package(file location…)
-S fileSearch which package is the file belong to (such as rpm –qf)

===============================================
apt-get
===============================================
apt-get
-dOnly download the package file
-yforce to answer yes
install  packageinstall
remove packageremove
updatelist available package

===============================================
rpm
===============================================
rpm db location: /var/lib/rpm
rpm  --rebuilddb

---------------------------------------------------------------------------
Package Verify
---------------------------------------------------------------------------
-V  Package : Verify the changed file belonged to the package and list them.
-Va : List all the changed file belonged to all packages.
-Vp Package : List possibly changed file belonged to the package.
-Vf  file : Verify if the file is been changed.
-K Package : check the Package’s  MD5 checksum and pgp.
--checksigcheck Package’s MD5 checksum and pgp.
S file Size differs
M Mode differs (includes permissions and file type)
5 MD5 sum differs
D Device major/minor number mis-match
L readLink(2) path mis-match
U User ownership differs
G Group ownership differs
T mTime differs
import keys : rpm --import /usr/share/rhn/RPM-GPG-KEY
/usr/share/doc/rpm-4.4.2/RPM-GPG-KEY
/usr/share/doc/fedora-release-5/RPM-GPG-KEY
/etc/pki/rpm-gpg/RPM-GPG-KEY

---------------------------------------------------------------------------
rpm -ivh Package
---------------------------------------------------------------------------

-i install
-v show the process
-h show the process in percent.
--nodeps :
--nomd5 :
--noscripts :
--replacefiles :
--replacepkgs :
--force :
--test :
---------------------------------------------------------------------------
Upgrade and Update
---------------------------------------------------------------------------
-Uvh : Install and update.
-Fvh : Upgrade only if the older package is installed

---------------------------------------------------------------------------
Remove Package
---------------------------------------------------------------------------
rpm e Package
rpm e Package --allmaches : Remove all versions of the
package which match PACKAGE_NAME.
rpm e Package --nodeps : Don't check dependencies before
uninstalling the packages.

---------------------------------------------------------------------------
Query
---------------------------------------------------------------------------
rpm  -q  Package : check if the package exists.
rpm  -ql Package : List all the files belonged to the package.
rpm  -qi Package : Print info about the package.
rpm  -qf file : Search which package is the file belong to.
rpm  -qc Package : List the config file of the package.
rpm  -qd Package : List the document about the package location.
rpm  -qR Package : List the dependency of the package(prequesite).
rpm  -qa :List all the installed package.

Tuesday, October 09, 2012

Linux Bash Array Usage using IFS


Ref. http://go-linux.blogspot.tw/2007/03/basharray.html


#!/bin/bash
#Put everything into array.
array=(Redhat Novell MicroSoft Sun IBM HP Dell)


#Print all value in array , seperated by IFS(:).
IFS=:
echo "${array[*]}"

#Print all value in array , seperated by IFS(\n).
IFS=$'\n'
echo "${array[*]}"

#Print all value in array , seperated.
echo "${array[@]}"

#Print the count of array.
echo "${#array[@]}"

Re:
array[0]=Redhat
array[1]=Novell
array[2]=MicroSoft
array[3]=Sun
array[4]=IBM
array[5]=HP
array[6]=Dell
Redhat:Novell:MicroSoft:Sun:IBM:HP:Dell
Redhat
Novell
MicroSoft
Sun
IBM
HP
Dell
Redhat Novell MicroSoft Sun IBM HP Dell
7

Monday, October 08, 2012

Linux RPM Query command


Ref. http://www.cyberciti.biz/faq/how-do-i-find-what-dependencies-a-rpm-file-has/

How do I find what dependencies a rpm file has?

rpm -qpR {.rpm-file}
rpm -qR {package-name}

How do I remove rpm package recursively?

By using yum remove ---  
yum remove  {package-name}

Saturday, October 06, 2012

Monday, October 01, 2012

Shell Script Output with Color - Bash

Ref. http://linuxtidbits.wordpress.com/2008/08/11/output-color-on-bash-scripts/



#!/bin/bash
# tputcolors

echo
echo -e "$(tput bold) reg  bld  und   tput-command-colors$(tput sgr0)"

for i in $(seq 1 7); do
  echo " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0)  \$(tput setaf $i)"
done

echo ' Bold            $(tput bold)'
echo ' Underline       $(tput sgr 0 1)'
echo ' Reset           $(tput sgr0)'
echo



#!/bin/bash
# scriptname - description of script

# Text color variables
txtund=$(tput sgr 0 1)          # Underline
txtbld=$(tput bold)             # Bold
bldred=${txtbld}$(tput setaf 1) #  red
bldblu=${txtbld}$(tput setaf 4) #  blue
bldwht=${txtbld}$(tput setaf 7) #  white
txtrst=$(tput sgr0)             # Reset
info=${bldwht}*${txtrst}        # Feedback
pass=${bldblu}*${txtrst}
warn=${bldred}*${txtrst}
ques=${bldblu}?${txtrst}