Write Hostname into a file during policy execution

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-06-2014 07:30 AM
Hi
We have problems deploying a network profile because of a defect in the way Casper Suite handles Wired 802.1x Network Profiles.
Now we would like to copy and install the profile on the machines with a Policy. The steps are
- Install the profile in /tmp
- Run a command that replaces a placeholder with the correct hostname of the machine in the profile needed for the connection
- Install the profile
I tried this command:
#!/bin/sh
hostname="$2"
sed -i.backup -e 's/hostname-to-be-replaced/$hostname/' /private/tmp/Wired and Wireless.mobileconfig
# /usr/bin/profiles -I -F /tmp/Wired and Wireless.mobileconfig
But somehow the $2 Variable for the hostname is not recognized. It just writes "$hostname" into the file where the placeholder "hostname-to-be-replaced" was. Any Idea how the correct syntax should be here?
Thanks for your help!
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-06-2014 12:21 PM
Just figured it out by myself :-). Like this ist works
hostname="$2"
sed -i.backup -e "s/hostname-to-be-replaced/$hostname/" /private/tmp/Wired and Wireless.mobileconfig
# /usr/bin/profiles -I -F /tmp/UEFA Wired and Wireless.mobileconfig
