Skip to content

Commit

Permalink
Merge pull request #49 from hypriot/use-sed-with-abs-path
Browse files Browse the repository at this point in the history
Use absolute path to sed to avoid gnu-sed
  • Loading branch information
StefanScherer committed Mar 20, 2016
2 parents b496fcb + ffedcb2 commit 5892ecc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Darwin/flash
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ else
sudo /bin/dd bs=1m if=${image} of=/dev/r${disk}
fi

boot=$(df | grep --color=never "/dev/${disk}s1" | sed 's,.*/Volumes,/Volumes,')
boot=$(df | grep --color=never "/dev/${disk}s1" | /usr/bin/sed 's,.*/Volumes,/Volumes,')
if [ "${boot}" == "" ]; then
COUNTER=0
while [ $COUNTER -lt 5 ]; do
sleep 1
boot=$(df | grep --color=never "/dev/${disk}s1" | sed 's,.*/Volumes,/Volumes,')
boot=$(df | grep --color=never "/dev/${disk}s1" | /usr/bin/sed 's,.*/Volumes,/Volumes,')
if [ "${boot}" != "" ]; then
break
fi
Expand Down Expand Up @@ -221,23 +221,23 @@ if [ "${boot}" ]; then
if [ -f "${boot}/device-init.yaml" ]; then
if [ ! -z "${SD_HOSTNAME}" ]; then
echo "Set hostname=${SD_HOSTNAME}"
sed -i "" -e "s/.*hostname:.*\$/hostname: ${SD_HOSTNAME}/" "${boot}/device-init.yaml"
/usr/bin/sed -i "" -e "s/.*hostname:.*\$/hostname: ${SD_HOSTNAME}/" "${boot}/device-init.yaml"
fi
fi

# legacy: /boot/occidentalis.txt of old Hector release
if [ -f "${boot}/occidentalis.txt" ]; then
if [ ! -z "${SD_HOSTNAME}" ]; then
echo "Set hostname=${SD_HOSTNAME}"
sed -i "" -e "s/.*hostname.*=.*\$/hostname=${SD_HOSTNAME}/" "${boot}/occidentalis.txt"
/usr/bin/sed -i "" -e "s/.*hostname.*=.*\$/hostname=${SD_HOSTNAME}/" "${boot}/occidentalis.txt"
fi
if [ ! -z "${WIFI_SSID}" ]; then
echo "Set wifi_ssid=${WIFI_SSID}"
sed -i "" -e "s/.*wifi_ssid.*=.*\$/wifi_ssid=${WIFI_SSID}/" "${boot}/occidentalis.txt"
/usr/bin/sed -i "" -e "s/.*wifi_ssid.*=.*\$/wifi_ssid=${WIFI_SSID}/" "${boot}/occidentalis.txt"
fi
if [ ! -z "${WIFI_PASSWORD}" ]; then
echo "Set wifi_password=${WIFI_PASSWORD}"
sed -i "" -e "s/.*wifi_password.*=.*\$/wifi_password=${WIFI_PASSWORD}/" "${boot}/occidentalis.txt"
/usr/bin/sed -i "" -e "s/.*wifi_password.*=.*\$/wifi_password=${WIFI_PASSWORD}/" "${boot}/occidentalis.txt"
fi
fi
fi
Expand Down

0 comments on commit 5892ecc

Please sign in to comment.