Pejman Moghadam / Scripts

Package Downloader - Slackeware 13.1

Public domain


#!/bin/bash

URL="http://slackware.at/data/slackware-13.1"
DIRS="a ap d e f k kde l n t tcl x xap y"

YEL='\E[1;33m'
BLU='\E[1;34m'
RES='\E[0m'

for DIR in ${DIRS};do 
  echo -e "${BLU}* Checking ${URL}/slackware/${DIR}/${RES}"
  PKGS=$(links -dump "${URL}/slackware/${DIR}/" |\
      grep '\.txz '                        |\
      sed -e 's,^ *,,'                     |\
      sed -e 's, .*,,' )
  for PKG in $PKGS; do
    if [ "$PKG" != "" ]; then
      NAME=$(echo $PKG | sed -e 's,\.txz$,,')
      ls /var/log/packages/${NAME} &> /dev/null
      if [ "$?" == "2" ]; then
        echo -e "${YEL}$NAME not installed, start downloading ${PKG} ${RES}"
        mkdir -p ${DIR}
        wget -P ${DIR} -c "${URL}/slackware/${DIR}/${PKG}"
      fi
    fi
  done
done

BY: Pejman Moghadam
TAG: package-management, bash-script, bash
DATE: 2011-06-10 20:33:19


Pejman Moghadam / Scripts [ TXT ]