review the legacy/compat code for bootcd-<nodefamily>
Thierry Parmentelat [Wed, 23 Apr 2008 14:44:41 +0000 (14:44 +0000)]
plc.d/bootcd

index 78643f0..e628dd7 100755 (executable)
@@ -28,17 +28,19 @@ case "$1" in
        dialog "$MESSAGE"
 
        ########## legacy myplcs - temporary code
+       # create /etc/planetlab/nodefamily if missing
        [ -f /etc/planetlab/nodefamily ] || { mkdir -p /etc/planetlab ; echo "planetlab-i386" > /etc/planetlab/nodefamily ; }
+       # move if plain directories
+       for legacydir in /usr/share/bootcd /var/www/html/download ; do
+           if [ -d "${legacydir}" ] && [ ! -h ${legacydir} ] ; then
+               rm -rf ${legacydir}-legacy
+               mv -f ${legacydir} ${legacydir}-legacy
+           fi
+       done
        ########## end
 
        # get the default nodefamily
        def_nodefamily=$(cat /etc/planetlab/nodefamily)
-
-       ########## legacy myplcs - temporary code
-       [ -d /usr/share/bootcd ] && mv /usr/share/bootcd /usr/share/bootcd-${def_nodefamily}
-       [ -d /var/www/html/download ] && mv /var/www/html/download /var/www/html/download-${def_nodefamily}
-       ########## end
-
        
        # Customize the Boot CD : run build.sh on all available bootcd's
        shopt -s nullglob
@@ -55,10 +57,10 @@ case "$1" in
        
            # the default: create symlinks to the actual locations
            if [ "${nodefamily}" == "${def_nodefamily}" ] ; then
-               rm -rf /var/www/html/download
-               ln -s /var/www/html/download-${nodefamily} /var/www/html/download
                rm -rf /usr/share/bootcd
                ln -s /usr/share/bootcd-${nodefamily} /usr/share/bootcd
+               rm -rf /var/www/html/download
+               ln -s /var/www/html/download-${nodefamily} /var/www/html/download
            fi
        done