Merge pull request #1951 from lrusak/script-updates

some minor script updates
This commit is contained in:
Christian Hewitt 2017-09-20 19:39:38 +04:00 committed by GitHub
commit ee5f8dabee
2 changed files with 51 additions and 21 deletions

View File

@ -21,7 +21,7 @@ git_clone() {
# git_clone https://repo.url branch ./target_dir [githash] # git_clone https://repo.url branch ./target_dir [githash]
echo "[mkpkg] Checking out $1 ..." echo "[mkpkg] Checking out $1 ..."
if [ ! -d "$3" ]; then if [ ! -d "$3" ]; then
git clone --recursive "$1" -b $2 "$3" git clone --single-branch --depth=1 --recursive "$1" -b $2 "$3"
else else
if [ -d "$3" ] ; then if [ -d "$3" ] ; then
cd "$3" cd "$3"

View File

@ -69,15 +69,29 @@ update_addons_xml() {
touch_addons_xml() { touch_addons_xml() {
for PROJECT in $(ls -1 projects); do for PROJECT in $(ls -1 projects); do
for archfile in projects/$PROJECT/linux/linux.*.conf ; do if [ -p "$projects/$PROJECT/devices" ]; then
ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` for DEVICE in $(ls -1 projects/$PROJECT/devices); do
if [ ! -d target/addons/$ADDON_VERSION/$PROJECT/$ARCH ]; then for archfile in projects/$PROJECT/devices/$DEVICE/linux/linux.*.conf; do
break ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'`
fi if [ ! -d target/addons/$ADDON_VERSION/$DEVICE/$ARCH ]; then
if [ ! -f target/addons/$ADDON_VERSION/$PROJECT/$ARCH/addons.xml ]; then break
touch target/addons/$ADDON_VERSION/$PROJECT/$ARCH/addons.xml fi
fi if [ ! -f target/addons/$ADDON_VERSION/$DEVICE/$ARCH/addons.xml ]; then
done touch target/addons/$ADDON_VERSION/$DEVICE/$ARCH/addons.xml
fi
done
done
else
for archfile in projects/$PROJECT/linux/linux.*.conf; do
ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'`
if [ ! -d target/addons/$ADDON_VERSION/$PROJECT/$ARCH ]; then
break
fi
if [ ! -f target/addons/$ADDON_VERSION/$PROJECT/$ARCH/addons.xml ]; then
touch target/addons/$ADDON_VERSION/$PROJECT/$ARCH/addons.xml
fi
done
fi
done done
} }
@ -95,18 +109,27 @@ upload() {
} }
build() { build() {
[ -n "$3" ] && DEVICE="$3" || DEVICE=""
for PROJECT in $2; do for PROJECT in $2; do
for archfile in projects/$PROJECT/linux/linux.*.conf ; do if [ -n "$DEVICE" ]; then
ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` for archfile in projects/$PROJECT/devices/$DEVICE/linux/linux.*.conf; do
for package in $(find $1 -iname package.mk) ; do ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'`
(
. $package
if [ "$PKG_IS_ADDON" = "yes" ] ; then
ADDON=$PKG_NAME
PROJECT=$PROJECT ARCH=$ARCH ./scripts/create_addon $ADDON
fi
)
done done
else
for archfile in projects/$PROJECT/linux/linux.*.conf; do
ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'`
done
fi
for package in $(find $1 -iname package.mk) ; do
(
. $package
if [ "$PKG_IS_ADDON" = "yes" ] ; then
ADDON=$PKG_NAME
PROJECT=$PROJECT DEVICE=$DEVICE ARCH=$ARCH ./scripts/create_addon $ADDON
fi
)
done done
done done
} }
@ -176,12 +199,19 @@ if [ "$1" = "-b" -o "$1" = "-ru" ]; then
if [ "$1" = "-b" ]; then if [ "$1" = "-b" ]; then
[ -n "$3" ] && project="$3" || project="$(ls -1 projects)" [ -n "$3" ] && project="$3" || project="$(ls -1 projects)"
if [ "$3" == "RPi" ]; then
project="RPi"
device="RPi"
elif [ "$3" == "RPi2" ]; then
project="RPi"
device="RPi2"
fi
fi fi
fi fi
case $1 in case $1 in
-b) -b)
build "$repo" "$project" build "$repo" "$project" "$device"
;; ;;
-u) -u)
upload upload