Ensured removal of extraction directories or existing apps to avoid writing errors when extracting/copying.

This commit is contained in:
Michael Griffin 2013-04-17 19:51:45 -07:00
parent 19d7978969
commit 43b2fb0f32
5 changed files with 24 additions and 8 deletions

View File

@ -1,3 +1,5 @@
--- ---
- name: Remove existing app if present
file: path=/Applications/$app_name.app state=absent
- name: Copy $app_name_pretty app to Applications directory - name: Copy $app_name_pretty app to Applications directory
command: cp -R $app_name.app /Applications chdir=$downloads command: cp -R $app_name.app /Applications chdir=$downloads

View File

@ -3,11 +3,14 @@
get_url: url=$app_url dest=$downloads/$app_name.dmg get_url: url=$app_url dest=$downloads/$app_name.dmg
- name: Mount $app_name_pretty image - name: Mount $app_name_pretty image
command: hdiutil attach $app_name.dmg chdir=$downloads command: hdiutil attach $app_name.dmg chdir=$downloads
- name: Remove existing app if present
file: path=/Applications/$app_name.app state=absent
when_string: $installer_type == 'app'
- name: Copy $app_name_pretty app to Applications directory - name: Copy $app_name_pretty app to Applications directory
command: cp -R ${mount_path}$app_name.app /Applications command: cp -R $mount_path$app_name.app /Applications
when_string: $installer_type == 'app' when_string: $installer_type == 'app'
- name: Install $app_name pkg - name: Install $app_name pkg
command: sudo installer -package ${mount_path}$app_name.pkg -target $install_target command: sudo installer -package $mount_path$app_name.pkg -target $install_target
when_string: $installer_type == 'pkg' when_string: $installer_type == 'pkg'
- name: Unmount $app_name_pretty image - name: Unmount $app_name_pretty image
command: hdiutil detach $mount_path command: hdiutil detach $mount_path

View File

@ -1,2 +1,3 @@
---
- name: Install $app_name pkg - name: Install $app_name pkg
command: sudo installer -package $app_name.pkg -target $install_target command: sudo installer -package $app_name.pkg -target $install_target

View File

@ -1,10 +1,15 @@
--- ---
- name: Download $app_name_pretty - name: Download $app_name_pretty
get_url: url=$app_url dest=${downloads}/$app_name.tar get_url: url=$app_url dest=$downloads/$app_name.tar
- name: Remove existing extraction directory if present
file: path=$downloads$app_name/ state=absent
- name: Create an extraction directory - name: Create an extraction directory
file: path=${downloads}${app_name}/ state=directory file: path=$downloads$app_name/ state=directory
- name: Extract $app_name_pretty tarball - name: Extract $app_name_pretty tarball
command: tar xf $app_name.tar -C $app_name/ chdir=$downloads command: tar xf $app_name.tar -C $app_name/ chdir=$downloads
- name: Remove existing app if present
file: path=/Applications/$app_name.app state=absent
when_string: $installer_type == 'app'
- name: Copy $app_name_pretty app to Applications directory - name: Copy $app_name_pretty app to Applications directory
command: cp -R $app_name/$app_name.app /Applications chdir=$downloads command: cp -R $app_name/$app_name.app /Applications chdir=$downloads
when_string: $installer_type == 'app' when_string: $installer_type == 'app'
@ -12,4 +17,4 @@
command: sudo installer -package $app_name/$app_name.pkg -target $install_target chdir=$downloads command: sudo installer -package $app_name/$app_name.pkg -target $install_target chdir=$downloads
when_string: $installer_type == 'pkg' when_string: $installer_type == 'pkg'
- name: Remove extraction directory - name: Remove extraction directory
file: path=${downloads}${app_name}/ state=absent file: path=$downloads$app_name/ state=absent

View File

@ -1,10 +1,15 @@
--- ---
- name: Download $app_name_pretty - name: Download $app_name_pretty
get_url: url=$app_url dest=${downloads}/$app_name.zip get_url: url=$app_url dest=$downloads/$app_name.zip
- name: Remove existing extraction directory if present
file: path=$downloads$app_name/ state=absent
- name: Create an extraction directory - name: Create an extraction directory
file: path=${downloads}${app_name}/ state=directory file: path=$downloads$app_name/ state=directory
- name: Extract $app_name_pretty zip archive - name: Extract $app_name_pretty zip archive
command: unzip $app_name.zip -d $app_name/ chdir=$downloads command: unzip $app_name.zip -d $app_name/ chdir=$downloads
- name: Remove existing app if present
file: path=/Applications/$app_name.app state=absent
when_string: $installer_type == 'app'
- name: Copy $app_name_pretty app to Applications directory - name: Copy $app_name_pretty app to Applications directory
command: cp -R $app_name/$app_name.app /Applications chdir=$downloads command: cp -R $app_name/$app_name.app /Applications chdir=$downloads
when_string: $installer_type == 'app' when_string: $installer_type == 'app'
@ -12,4 +17,4 @@
command: sudo installer -package $app_name/$app_name.pkg -target $install_target chdir=$downloads command: sudo installer -package $app_name/$app_name.pkg -target $install_target chdir=$downloads
when_string: $installer_type == 'pkg' when_string: $installer_type == 'pkg'
- name: Remove extraction directory - name: Remove extraction directory
file: path=${downloads}${app_name}/ state=absent file: path=$downloads$app_name/ state=absent