Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qbit/dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Bieber committed Mar 16, 2012
2 parents 2334cf4 + db15421 commit 446d203
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 24 deletions.
9 changes: 9 additions & 0 deletions bin/clean_node
@@ -0,0 +1,9 @@
NODE=/usr/ports/www/node

if [ -d $NODE ]; then
rm -rf $NODE;
cd /usr && cvs checkout ports/www/node
cd $NODE
else
echo "No ${NODE} dir, perhaps you need to checkout ports?"
fi
15 changes: 7 additions & 8 deletions bin/update_snap
Expand Up @@ -16,10 +16,9 @@ fi
# etc sets will be ignored.. make sure base is last!
set -A sets 'comp' 'game' 'man' 'xbase' 'xfont' 'xserv' 'xshare' 'etc' 'xetc' 'base'

find_mirror
set_snap_path

URL=$( echo $PKG_PATH | sed -e 's/\/packages//' )
echo $URL
echo $SNAP_PATH

if [ ! -e $DST ]; then
mkdir $DST
Expand All @@ -28,15 +27,15 @@ fi
(
cd $DST

ftp $OPTS ${URL}bsd
ftp $OPTS ${URL}bsd.mp
ftp $OPTS ${URL}bsd.rd
ftp $OPTS ${SNAP_PATH}bsd
ftp $OPTS ${SNAP_PATH}bsd.mp
ftp $OPTS ${SNAP_PATH}bsd.rd

for set in ${sets[@]}; do
ftp $OPTS ${URL}${set}${VER}.tgz
ftp $OPTS ${SNAP_PATH}${set}${VER}.tgz
done

ftp $OPTS ${URL}INSTALL.${ARCH}
ftp $OPTS ${SNAP_PATH}INSTALL.${ARCH}

sudo cp /bsd /obsd
sudo cp /bsd.rd /obsd.rd
Expand Down
49 changes: 34 additions & 15 deletions common/dot_kshlib
Expand Up @@ -26,25 +26,44 @@ function lockie {

}

set -A openbsd_mirrors '10.0.1.100' 'ftp3.usa.openbsd.org' 'ftp.openbsd.org'

function find_mirror {
for mirror in ${openbsd_mirrors[@]}; do
ping -i 1 -q -c 1 $mirror 2>&1 > /dev/null
if [ "$?" -eq "0" ]; then
OPENBSD_MIRROR=$mirror
break;
fi
done
}

function set_snap_path {
if [ "${SNAP_PATH}" == "" ]; then
echo "${bold}Finding a mirror${white}"

if [ "${OPENBSD_MIRROR}" == "" ]; then
find_mirror
fi

export SNAP_PATH="http://${OPENBSD_MIRROR}/pub/OpenBSD/snapshots/$( machine )/"
fi

echo "${bold}Using${white} ${green}${OPENBSD_MIRROR}${white}"
}

function set_pkg_path {
if [ "${PKG_PATH}" == "" ]; then
echo -n "${bold}Finding a mirror${white}"
set -A mirrors '10.0.1.100' 'ftp3.usa.openbsd.org' 'ftp.openbsd.org'

for mirror in ${mirrors[@]}; do
echo -n "."
ping -i 1 -q -c 1 $mirror 2>&1 > /dev/null
if [ "$?" -eq "0" ]; then
MIRROR=$mirror
echo ""
break;
fi
done

export PKG_PATH="http://${MIRROR}/pub/OpenBSD/snapshots/packages/$( machine )/"
echo "${bold}Finding a mirror${white}"

if [ "${OPENBSD_MIRROR}" == "" ]; then
find_mirror
fi

export PKG_PATH="http://${OPENBSD_MIRROR}/pub/OpenBSD/snapshots/packages/$( arch -s )/"
fi

echo "${bold}Using${white} ${green}${MIRROR}${white}"
echo "${bold}Using${white} ${green}${OPENBSD_MIRROR}${white}"
}

# vim: set filetype=shell
2 changes: 1 addition & 1 deletion common/dot_kshrc
Expand Up @@ -10,7 +10,7 @@ fi

if [ $OS == "OpenBSD" ]; then
function pkg_add {
find_mirror
set_pkg_path
sudo /usr/sbin/pkg_add $@
}

Expand Down

0 comments on commit 446d203

Please sign in to comment.