/ Published in: Bash
AIX does not have Package Manager like YUM for Open Source Software.
So I made a script to automatically install RPM packages on AIX box by downloading it from www.oss4aix.org site via ftp .
It is very first version, it does not have all the necessary checks, but I do not have too much time to polish it.
Actually it works. It downloads and installs all the necessary software and it dependencies ( thanks to Michael Perzl http://www.perzl.org/aix/index.php?n=FAQs.FAQs#rpm-dependency-hell ).
I saw similar thing here: http://earth2baz.net/rpmplus/
But it downloads entire Repository. I do not need that. So made my own script.
Actually it is for Korn Shell wich is deffault on AIX.
So I made a script to automatically install RPM packages on AIX box by downloading it from www.oss4aix.org site via ftp .
It is very first version, it does not have all the necessary checks, but I do not have too much time to polish it.
Actually it works. It downloads and installs all the necessary software and it dependencies ( thanks to Michael Perzl http://www.perzl.org/aix/index.php?n=FAQs.FAQs#rpm-dependency-hell ).
I saw similar thing here: http://earth2baz.net/rpmplus/
But it downloads entire Repository. I do not need that. So made my own script.
Actually it is for Korn Shell wich is deffault on AIX.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh # Aix71extras.sh version 0.1 beta # Copyleft (c) 2015 - Alexander Teterkin - [email protected] # http://www.gnu.org/licenses/gpl-3.0.txt # VARS HOST=www.oss4aix.org USER=anonymous PASS=teterkin@gmail.com DIR=rpmdb/deplists/aix71 DIR2=/everything/RPMS TEMPDIR=TEMP SOFTDIR=SOFT LOG=$0.log DOWNLOADS=$TEMPDIR/downloads.deps MAJORVS=""; # Files to Install: FILES=" bash-4.3-12.aix5.1.ppc gcc-4.8.3-1.aix7.1.ppc less-466-1.aix5.1.ppc mc-4.7.0.4-2.aix5.1.ppc screen-4.2.1-1.aix5.1.ppc unzip-6.0-2.aix5.1.ppc wget-1.16-1.aix5.1.ppc bzip2-1.0.5-3.aix5.3.ppc " # FUNCTIONS makecmdlist() { echo "ftp -inv $HOST << EOF"; echo "user $USER $PASS"; echo "cd $DIR"; echo "lcd $TEMPDIR"; echo "$FILES" | while read LINE; do if [ "$LINE" != "" ]; then echo "get $LINE.deps"; fi done echo "bye"; echo "EOF"; } makecmdlist2() { echo "ftp -inv $HOST << EOF"; echo "user $USER $PASS"; echo "cd $DIR2"; echo "lcd $SOFTDIR"; echo "bin"; cat $DOWNLOADS | while read LINE; do if [ "$LINE" != "" ]; then echo "get $LINE"; fi done echo "bye"; echo "EOF"; } makecmdlist3() { echo "ftp -inv $HOST << EOF"; echo "user $USER $PASS"; echo "cd $DIR2"; echo "lcd $SOFTDIR"; echo "bin"; echo "$FILES" | while read LINE; do if [ "$LINE" != "" ]; then echo "get $LINE.rpm"; fi done echo "bye"; echo "EOF"; } doline() { echo ====================== } removeduplicates() { FILELIST=`ls -1 | grep rpm`; PCKGLIST=$(echo "$FILELIST" | while read LINE; do PCKG=`echo $LINE | awk -F "[0-9]" '{ print $1 '}`; echo $PCKG; done | sort | uniq ); echo $PCKGLIST echo "$PCKGLIST" | while read LINE; do HM=`echo "$FILELIST" | grep -c ^$LINE[0-9];`; if [ "$HM" -gt 1 ]; then echo "Found duplicates: $LINE ($HM):"; doline; # It was sorted, but we sort again by the 3rd column SORTED=`echo "$FILELIST" | grep ^$LINE[0-9] | sort -t- +2 -n;`; echo "$SORTED"; MAJORV=`echo "$SORTED" | tail -1`; MAJORVS="$MAJORVS""$MAJORV\n" doline; fi done MAJORVS=`echo "$MAJORVS"| grep -v ^$`; echo echo "Major versions:" echo "$MAJORVS"; echo echo "Duplicates:"; echo "$MAJORVS" | while read LINE; do PCKG=`echo $LINE | awk -F "[0-9]" '{ print $1 '}`; DUP=`echo "$FILELIST" | grep $PCKG | grep -v "$LINE";`; echo "Moving $DUP to TEMP folder..."; mv $DUP TEMP && echo "Done."; done } # MAIN mkdir $TEMPDIR mkdir $SOFTDIR CMDS=$(makecmdlist); echo "$CMDS" > $TEMPDIR/$0.temp; sh $TEMPDIR/$0.temp cd $TEMPDIR cat *.deps | sort | uniq > ../$DOWNLOADS cd .. CMDS2=$(makecmdlist2); echo "$CMDS2" > $TEMPDIR/$0.temp2; sh $TEMPDIR/$0.temp2 CMDS3=$(makecmdlist3); echo "$CMDS3" > $TEMPDIR/$0.temp3; sh $TEMPDIR/$0.temp3 cd $SOFTDIR mkdir TEMP removeduplicates; ls -1 | grep rpm | awk -F "[0-9]" {' print $1 '} | while read LINE; do if rpm -qa | grep "$LINE" 2>&1 > /dev/null; then echo "$LINE exists. Skipping..."; else echo "Installing $LINE..."; SN=`ls -1 | grep $LINE`; rpm -Uhv $SN; fi; done cd ..