Skip to content

Commit

Permalink
Add scripts for preparing global zone
Browse files Browse the repository at this point in the history
  • Loading branch information
sax committed Mar 8, 2014
1 parent e783fdc commit 52a11b4
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bin/prepare_global_zone
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# curl -k https://gist.githubusercontent.com/sax/9138190/raw/prepare_global_zone | bash -s

echo "*************************************************************"
echo "Updating system to allow user modification"
mkdir -p /opt/custom/smf
mkdir -p /opt/custom/method

curl --silent -k https://gist.githubusercontent.com/sax/9138190/raw/install-userfiles -o /opt/custom/method/install-userfiles
curl --silent -k https://gist.githubusercontent.com/sax/9138190/raw/install-userfiles.xml -o /opt/custom/smf/install-userfiles.xml
curl --silent -k https://gist.githubusercontent.com/sax/9138190/raw/persist-userfiles -o /opt/custom/method/persist-userfiles
curl --silent -k https://gist.githubusercontent.com/sax/9138190/raw/persist-userfiles.xml -o /opt/custom/smf/persist-userfiles.xml

chmod -R +x /opt/custom/method
echo "*************************************************************"
echo "In order to use tools such as usermod, please do the following:"
echo " svcadm disable -s persist-userfiles"
echo " useradd ..."
echo " svcadm enable -s persist-userfiles"
echo
echo
echo "*************************************************************"
echo "Now reboot to ensure that everything is kosher."
44 changes: 44 additions & 0 deletions bin/prepare_gz_users
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
echo "*************************************************************"
echo "Switching system into user modifiable state"

svcadm disable -s persist-userfiles

echo "*************************************************************"
echo "Creating vagrant user"
useradd -d /usbkey/vagrant -m -s /bin/bash vagrant
usermod -P'Primary Administrator' vagrant

echo "*************************************************************"
echo "Setting password for Vagrant user. Please set it to 'vagrant'"
passwd vagrant

echo "*************************************************************"
echo "Setting password for root user. Please set it to 'vagrant'"
passwd root

echo "*************************************************************"
echo "Switching system back into non-user modifiable state"
svcadm enable -s persist-userfiles

echo "*************************************************************"
echo "Configuring profile for vagrant user"

echo 'if [ -e $HOME/.bashrc ]; then' > /usbkey/vagrant/.bash_profile
echo ' . $HOME/.bashrc' >> /usbkey/vagrant/.bash_profile
echo 'fi' >> /usbkey/vagrant/.bash_profile
echo 'export PATH=/usr/bin:/usr/sbin/:smartdc/bin:/opt/local/bin:/opt/local/sbin:/usbkey/vagrant/bin' >> /usbkey/vagrant/.bash_profile

chown vagrant:other /usbkey/vagrant/.bash_profile

echo "*************************************************************"
echo "Configuring ssh access for vagrant user"
mkdir -p /usbkey/vagrant/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /usbkey/vagrant/.ssh/authorized_keys
echo 'export PATH=/usr/bin:/usr/sbin/:smartdc/bin:/opt/local/bin:/opt/local/sbin:/usbkey/vagrant/bin' > /usbkey/vagrant/.ssh/environment
chown -R vagrant:other /usbkey/vagrant/.ssh
chmod -R 0700 /usbkey/vagrant/.ssh

mkdir -p /usbkey/vagrant/bin
echo '#!/usr/bin/bash' > /usbkey/vagrant/bin/sudo
echo 'pfexec $@' >> /usbkey/vagrant/bin/sudo
chmod -R 0777 /usbkey/vagrant/bin

0 comments on commit 52a11b4

Please sign in to comment.