Skip to content

Commit

Permalink
Improve logic for 01_elemental-rootfs.yaml
Browse files Browse the repository at this point in the history
Every time when we want to write configurarion file in /usr/loca/etc
directory has to be checked and created properly

Signed-off-by: Michal Jura <mjura@suse.com>
  • Loading branch information
mjura committed Aug 4, 2022
1 parent 7b1dfc2 commit 4b3fc4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion framework/files/system/oem/01_elemental-rootfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ stages:
commands:
- |
if [ ! -e /usr/local/etc/hostname ]; then
[ ! -d /usr/local/etc ] && mkdir -p /usr/local/etc

This comment has been minimized.

Copy link
@kkaempf

kkaempf Aug 4, 2022

Contributor

Just call mkdir -p here, the test is superfluous

echo rancher-${RANDOM} > /usr/local/etc/hostname
fi
ln -sf /usr/local/etc/hostname /etc/hostname
Expand All @@ -16,7 +17,7 @@ stages:
if [ -s /usr/local/etc/machine-id ]; then
cat /usr/local/etc/machine-id > /etc/machine-id
else
mkdir -p /usr/local/etc
[ ! -d /usr/local/etc ] && mkdir -p /usr/local/etc

This comment has been minimized.

Copy link
@kkaempf

kkaempf Aug 4, 2022

Contributor

same here

cp /etc/machine-id /usr/local/etc
fi
- name: "Create essential persistent paths"
Expand Down

0 comments on commit 4b3fc4f

Please sign in to comment.