Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 151 lines (130 sloc) 4.411 kB
#!/bin/sh
. config/options
if [ -z "$1" ]; then
echo "usage: $0 package_name "
echo " or"
echo "usage: $0 --all"
echo "Option : user=ssh_username"
echo "Option : --force (overwrite files)"
echo "Option : --local copy file to \$BINARIES_DL"
echo "Option : --do-not-check"
exit 1
fi
ssh_user=""
pkg=""
CHECK=0
for arg in "$@"; do
case $arg in
user=*)
ssh_user="${arg#user=}@"
;;
--all)
ALL=0
;;
--force)
FORCE=0
;;
--local)
LOCAL_R=0
;;
--do-not-check)
CHECK=1
;;
*)
pkg=$arg
;;
esac
done
TEMP_SEND=$ROOT/$BUILD_NOARCH/ready-to-send
BINARIES_DL=$ROOT/binaries-dl/binaries.$VERSION_SUFFIX
mkdir -p $TEMP_SEND $BINARIES_DL
mod_name () {
uses=""
get_meta $1
for flag in $PKG_USE; do
type=`get_use_type $flag`
if [ -z "$type" ] && pkg_uses $PKG_NAME $flag; then
[ -z "$uses" ] && uses=$flag || uses="${uses}_${flag}"
fi
done
# check for platform-specific package overlay
if [ -r $PACKAGES/$PKG_SECTION/$1/install ] ; then
INSTALL_RULE=$PACKAGES/$PKG_SECTION/$1/install
else
INSTALL_RULE=$PACKAGES/$1/install
fi
PLATFORM_INSTALL="$PLATFORM_PACKAGES/$1/install"
[ -r "$PLATFORM_INSTALL" ] && INSTALL_RULE="$PLATFORM_INSTALL"
MACHINE_INSTALL="$MACHINE_PACKAGES/$1/install"
[ -r "$MACHINE_INSTALL" ] && INSTALL_RULE="$MACHINE_INSTALL"
# check for flavour-specific package overlay
FLAVOUR_INSTALL="$FLAVOUR_PACKAGES/$1/install"
[ -r "$FLAVOUR_INSTALL" ] && INSTALL_RULE="$FLAVOUR_INSTALL"
if [ "$PKG_OPK_ARCH" = unsupported ]; then
echo "$1 is not supported on $TARGET_ARCH"
fi
if [ -r $PACKAGES/$PKG_SECTION/$1/installdev ] ; then
INSTALLDEV_RULE=$PACKAGES/$PKG_SECTION/$1/installdev
else
INSTALLDEV_RULE=$PACKAGES/$1/installdev
fi
PLATFORM_INSTALLDEV="$PLATFORM_PACKAGES/$1/installdev"
[ -r "$PLATFORM_INSTALLDEV" ] && INSTALLDEV_RULE="$PLATFORM_INSTALLDEV"
MACHINE_INSTALLDEV="$MACHINE_PACKAGES/$1/installdev"
[ -r "$MACHINE_INSTALLDEV" ] && INSTALLDEV_RULE="$MACHINE_INSTALLDEV"
# check for flavour-specific package overlay
FLAVOUR_INSTALLDEV="$FLAVOUR_PACKAGES/$1/installdev"
[ -r "$FLAVOUR_INSTALLDEV" ] && INSTALLDEV_RULE="$FLAVOUR_INSTALLDEV"
if [ ! -f $INSTALL_RULE ]; then
echo "$1 is not a runtime package, skipping ..."
else
PKG_DBG_OPK_DEV=${PKG_NAME}-dbg_${PKG_VERSION}-${PKG_REV}dev${PKG_OPK_ARCH}_`uname -m`.opk
[ -f $PKGROOT/$PKG_OPK -a ! -L $PKGROOT/$PKG_OPK ] && create_link "$PKG_OPK" "nodev" "$uses"
[ -f $PKGROOT/$PKG_DBG_OPK -a ! -L $PKGROOT/$PKG_DBG_OPK ] && create_link "$PKG_DBG_OPK" "nodev" "$uses"
[ -f $DEVPKGROOT/$PKG_DBG_OPK_DEV -a ! -L $DEVPKGROOT/$PKG_DBG_OPK_DEV ] && create_link "$PKG_DBG_OPK_DEV" "dev" "$uses"
fi
if [ -f $INSTALLDEV_RULE ] ; then
[ -f $DEVPKGROOT/$PKG_OPK_DEV -a ! -L $DEVPKGROOT/$PKG_OPK_DEV ] && create_link "$PKG_OPK_DEV" "dev" "$uses"
else
echo "$1 is not a dev package, skipping ..."
fi
return 0
}
create_link () {
[ "$2" = "dev" ] && PROOT=$DEVPKGROOT || PROOT=$PKGROOT
[ -n "$3" ] && name="`echo $1 | sed -e "s,.opk,,"`_$3.opk" || name=$1
echo "$name"
if [ "$LOCAL_R" = 0 ] ; then
if [ -f $BINARIES_DL/$name ] ; then
[ -z $FORCE ] && echo "Package $name aready exists at $BINARIES_DL : use --force to overwrite it !" || ( echo "!! Warning : Using --force for $name !!" && ln -s $PROOT/$1 $TEMP_SEND/$name )
else
ln -s $PROOT/$1 $TEMP_SEND/$name
fi
else
if [ "$CHECK" = "0" ] ; then
if ! wget --no-check-certificate --passive-ftp --spider -nv -q $REPO_PATH/$name ; then
ln -s $PROOT/$1 $TEMP_SEND/$name
else
[ -z $FORCE ] && echo "Package $name aready exists at $REPO_PATH : use --force to overwrite it !" || ( echo "!! Warning : Using --force for $name !!" && ln -s $PROOT/$1 $TEMP_SEND/$name )
fi
else
ln -s $PROOT/$1 $TEMP_SEND/$name
fi
fi
}
send_to_server () {
if [ "$LOCAL_R" = 0 ] ; then
[ -z "`ls $TEMP_SEND`" ] && echo "Nothing to send !" || cp -L $TEMP_SEND/* $BINARIES_DL
else
[ -z "`ls $TEMP_SEND`" ] && echo "Nothing to send !" || scp -r $TEMP_SEND/* "$ssh_user"$F_PATH/
fi
}
get_all () {
for i in $PACKAGES/*/* ; do
j=${i#$PACKAGES/*/}
mod_name "$j"
done
}
[ "$ALL" = "0" ] && get_all || mod_name "$pkg"
send_to_server
[ -n "`ls $TEMP_SEND`" ] && rm $TEMP_SEND/*
Jump to Line
Something went wrong with that request. Please try again.