for the python3 distribution, ignore __pycache__ when copying rpm contents
authorparmentelat <thierry.parmentelat@inria.fr>
Tue, 18 Dec 2018 14:41:53 +0000 (15:41 +0100)
committerparmentelat <thierry.parmentelat@inria.fr>
Tue, 18 Dec 2018 14:42:03 +0000 (15:42 +0100)
build.sh

index ee4bd32..2e8c440 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -12,7 +12,7 @@
 #
 
 # Source PLC configuration
-. /etc/planetlab/plc_config
+source /etc/planetlab/plc_config
 
 # Do not tolerate errors
 set -e
@@ -26,7 +26,7 @@ BOOTSTRAPDIR="/boot"
 cd $(dirname $0)
 
 # Source bootmanager configuration
-. source/configuration
+source source/configuration
 
 # Write boot script. nodeconfig/boot/index.php retrieves the contents of this script
 # after checking the node id
@@ -52,7 +52,7 @@ fi
 sed -i -e "s@^MONITOR_SERVER.*@MONITOR_SERVER=$MONITOR_SERVER@" source/configuration
 
 install -D -m 644 $PLC_BOOT_CA_SSL_CRT source/cacert/$PLC_BOOT_HOST/cacert.pem
-if [ -f "$PLC_MONITOR_CA_SSL_CRT" ] ; then 
+if [ -f "$PLC_MONITOR_CA_SSL_CRT" ] ; then
        install -D -m 644 "$PLC_MONITOR_CA_SSL_CRT" source/cacert/$PLC_MONITOR_HOST/cacert.pem
 fi
 
@@ -64,9 +64,14 @@ fi
 # Add python code from the following packages
 # make sure they are in the 'Requires' header of the specfile
 required_rpms="pypcilib pyplnet"
-extra_libs=`mktemp -d "/tmp/.bootmanager.XXXXXX"`
+extra_libs=$(mktemp -d "/tmp/.bootmanager.XXXXXX")
 mkdir $extra_libs/source
-cp -p $(rpm -ql $required_rpms | grep -v '\.py[co]$') $extra_libs/source
+for entry in $(rpm -ql $required_rpms | grep -v '\.py[co]$'); do
+    if [ -d $entry ]; then
+        continue
+    fi
+    cp -p $entry $extra_libs/source
+done
 
 
 ########## create the bootmanager script
@@ -76,7 +81,7 @@ cat <<EOF > $DEST_SCRIPT
 # PlanetLab Boot Manager $VERSION
 #
 # DO NOT EDIT. Generated by $USER@$HOSTNAME at
-# $(date) 
+# $(date)
 #
 
 # Do not tolerate errors
@@ -108,4 +113,3 @@ if [ -f "$PLC_ROOT_GPG_KEY" -a -f "$PLC_ROOT_GPG_KEY_PUB" ] ; then
 else
     echo "Warning: Remember to sign $PWD/$DEST_SCRIPT!" >&2
 fi
-