]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/initscripts/helper/exoscale-setup
cloud: Execute user-data scripts at the end of initialization
[people/pmueller/ipfire-2.x.git] / src / initscripts / helper / exoscale-setup
index e9295cc9c2cb8373d9e720f19ca9923157f59a48..02fdda2a355d1e5c95cc55785cc91a7614e0a966 100644 (file)
@@ -83,25 +83,6 @@ import_exoscale_configuration() {
                chown setup.nobody "/home/setup/.ssh/authorized_keys"
        fi
 
-       # Download the user-data script only on the first boot
-       if [ ! -e "/var/ipfire/main/firstsetup_ok" ]; then
-               # Download user-data
-               local user_data="$(get user-data)"
-
-               # Save user-data script to be executed later
-               if [ "${user_data:0:2}" = "#!" ]; then
-                       echo "${user_data}" > /tmp/user-data.script
-                       chmod 700 /tmp/user-data.script
-
-                       # Run the user-data script
-                       local now="$(date -u +"%s")"
-                       /tmp/user-data.script &>/var/log/user-data.log.${now}
-
-                       # Delete the script right away
-                       rm /tmp/user-data.script
-               fi
-       fi
-
        # Import any previous settings for the local interfaces
         eval $(/usr/local/bin/readhash <(grep -E "^(GREEN|ORANGE)_.*=" /var/ipfire/ethernet/settings 2>/dev/null))
 
@@ -208,6 +189,22 @@ import_exoscale_configuration() {
                        echo "2,ACCEPT,INPUTFW,ON,std_net_src,ALL,ipfire,RED1,,TCP,,,ON,,,TGT_PORT,444,,,,,,,,,,,00:00,00:00,,AUTO,,dnat,,,,,second"
                ) >> /var/ipfire/firewall/input
 
+               # Download user-data
+               local user_data="$(get user-data)"
+
+               # Save user-data script to be executed later
+               if [ "${user_data:0:2}" = "#!" ]; then
+                       echo "${user_data}" > /tmp/user-data.script
+                       chmod 700 /tmp/user-data.script
+
+                       # Run the user-data script
+                       local now="$(date -u +"%s")"
+                       /tmp/user-data.script &>/var/log/user-data.log.${now}
+
+                       # Delete the script right away
+                       rm /tmp/user-data.script
+               fi
+
                # This script has now completed the first steps of setup
                touch /var/ipfire/main/firstsetup_ok
        fi