LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-29-2013, 06:33 AM   #1
clod89
Member
 
Registered: Jun 2012
Distribution: Slackware gentoo debian
Posts: 41

Rep: Reputation: Disabled
multilib install/update script


Just wanted to share a small script I wrote to install and update alien bob's multilib packages, I know there are other tools already but they were a bit overwhelming for me so I wrote my own.

It simply makes some sanity checks and then rsyncs /var/cache/multilib/ with alien bob's slackware 14 multilib packages(or whatever folder/slackware version you set up in the script) and upgradepkg --install-new the packages.

Anyway I hope it's of help to someone :-)

Code:
#!/bin/bash

if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

LOCALDIR="/var/cache/multilib/"
REMOTEDIR="rsync://taper.alienbase.nl/mirrors/people/alien/multilib/14.0/"
BLACKLISTFILE="/etc/slackpkg/blacklist"
LOG="/tmp/multilib-rsync.log"
if [ ! -d "$LOCALDIR" ]; then
	echo The local directory does not exists!;
	while true; do		
		read -p "Do you want me to create the folder $LOCALDIR?" yn 
 		case $yn in
  			[Yy]* ) mkdir $LOCALDIR; break;; 
  			[Nn]* ) echo "Aborting! Please fix your local dir";  exit 1;;
  			* ) echo "Please answer Y/y or N/n";;
 		esac
	done	
fi

grep -q "\[0\-9\]+alien" $BLACKLISTFILE ##comment out from here to ... 

if [ $? -eq 1 ]

then
	echo "Warning no [0-9]+alien found in $BLACKLISTFILE ! Updating with slackpkg might break your system!"
	while true; do		
		read -p "Do you want me to add it?" yn 
 		case $yn in
  			[Yy]* ) echo "[0-9]+alien" >> $BLACKLISTFILE; echo "[0-9]+alien added to $BLACKLISTFILE"; echo -e "\n"; break;; 
  			[Nn]* ) break;;
  			* ) echo "Please answer Y/y or N/n";;
 		esac
	done

fi

grep -q "\[0\-9\]+compat32" $BLACKLISTFILE 

if [ $? -eq 1 ]

then
	echo -e "\n"
	echo "Warning no [0-9]+compact32 found in $BLACKLISTFILE ! Updating with slackpkg might break your system!"
	while true; do		
		read -p "Do you want me to add it?" yn 
 		case $yn in
  			[Yy]* ) echo "[0-9]+compat32" >> $BLACKLISTFILE; echo "[0-9]+compat32 added to $BLACKLISTFILE"; echo -e "\n"; break;; 
  			[Nn]* ) break;;
  			* ) echo "Please answer Y/y or N/n";;
 		esac
	done
fi ##here to stop the script from checking the blacklist file 

echo "Downloading packages... Please wait"
rsync -azv --progress --delete --exclude "/debug/*"  $REMOTEDIR $LOCALDIR | tee $LOG
output=$(grep .txz$ $LOG) 

if [ $? -eq 0  ]

then 

echo $output | tr ' ' '\n'

while true; do

 read -p "There have been changes, do you want to update these packages?" yn 
 case $yn in
  [Yy]* ) for i in $output; do upgradepkg --install-new $LOCALDIR$i || echo "Error while upgrading!" && exit 1 ; done; echo "All packages updated!"; break;; 
  [Nn]* ) echo "Aborting!";  exit 1;;
  * ) echo "Please answer Y/y or N/n";;
 esac

done

else 

echo "No updates found!"

fi
 
Old 03-30-2013, 08:52 AM   #2
slackass
Member
 
Registered: Apr 2006
Location: SE Texas
Distribution: Slack64-15.0
Posts: 910

Rep: Reputation: 90
Thanks!
I changed LOCALDIR= to point to my local mirror and it seems to work perfect.
I used it to update a pre-installed multilib system.

Last edited by slackass; 03-30-2013 at 09:03 AM.
 
Old 03-30-2013, 08:56 AM   #3
clod89
Member
 
Registered: Jun 2012
Distribution: Slackware gentoo debian
Posts: 41

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by slackass View Post
Thanks!
I changed LOCALDIR= to point to my local mirror and it seems to work perfect.
You're welcome, I'm glad it helped someone.
 
1 members found this post helpful.
Old 03-30-2013, 09:11 AM   #4
slackass
Member
 
Registered: Apr 2006
Location: SE Texas
Distribution: Slack64-15.0
Posts: 910

Rep: Reputation: 90
This is what I've been useing.

#!/bin/sh

##INSTALL NEW MULTI-LIB
#mkdir /tmp/multi-lib
#mkdir /tmp/multi-lib/slackware64-compat32
#rsync -r -a -v --bwlimit=100 --delete --progress --stats rsync://rsync.slackware.org.uk/people/alien/multilib/current/ /tmp/multi-lib/
#cd /tmp/multi-lib
#upgradepkg --reinstall --install-new *.t?z
#cd /tmp/multi-lib/slackware64-compat32
#installpkg *?/*.t?z


##UPGRADE MULTI-LIB
rsync -r -a -v --bwlimit=100 --delete --progress --stats rsync://rsync.slackware.org.uk/people/alien/multilib/current/ /tmp/multi-lib/
cd /tmp/multi-lib
upgradepkg --install-new *.t?z
cd /tmp/multi-lib/slackware64-compat32
upgradepkg --install-new *?/*.t?z
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] mk-slack64-multilib : A tool to create slackware64+multilib tree/iso phenixia2003 Slackware 5 12-28-2012 05:42 AM
Slackware 13.37 64bit multilib questions: update to /patch Eeel Slackware 1 04-01-2012 02:32 AM
slackware glibc-zoneinfo-multilib-noarch update: why blacklisted/special? kingbeowulf Slackware 2 11-12-2011 05:10 PM
[SOLVED] Multilib does not work after kernel update David93 Slackware 6 07-13-2011 07:35 PM
FC3, 64-bit multilib, with many yum update conflicts sgl Fedora 2 06-04-2005 09:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration