Posted on 07-11-2017 10:28 AM
@dan.kubley this is a similar script to yours I wrote, but allows me to get the latest version.
Hope it helps
#!/bin/bash
# script to update vlc
find /Volumes -type d -name *vlc* -maxdepth 1 -exec hdiutil detach -quiet {} ;
if [[ -e "/tmp/vlc.dmg" ]]; then
rm "/tmp/vlc.dmg"
fi
# download and mount VLC
appName=`curl -s http://mirror.rasanegar.com/videolan/vlc/last/macosx/ | perl -pe 's/.*(vlc-.*dmg).*./$1/' | grep "vlc-" | tail -n1`
appURL="http://mirror.rasanegar.com/videolan/vlc/last/macosx/$appName"
curl -Lo "/tmp/vlc.dmg" "$appURL" --silent
hdiutil attach "/tmp/vlc.dmg" -nobrowse -quiet
# Install VLC
appVol=`find /Volumes -type d -name *vlc* -maxdepth 1`
ditto -rsrc "$appVol/VLC.app" "/Applications/VLC.app"
chown -R root:wheel "/Applications/VLC.app"
chmod -R 755 "/Applications/VLC.app"
sleep 3
hdiutil detach "$appVol" -quiet
sleep 3
rm "/tmp/vlc.dmg"
sleep 1
open "/Applications/VLC.app" &
exit 0
Posted on 07-20-2017 08:22 AM
Works perfect, thank you!
Posted on 07-25-2019 07:10 AM
This script works for me but it's also grabbing one version behind the latest release. It's currently installing 3.0.4 but if I manually go to the URL in the script it shows that 3.0.7.1 is the latest.
Posted on 11-18-2019 02:47 AM
Hi,
I modified the url http://mirror.rasanegar.com/videolan/vlc/last/macosx/ which is down
by https://get.videolan.org/vlc/3.0.8/macosx/
and it doesn't work
I have this error :
Executing Policy TEST Mise à jour VLC
Running script Mise à jour VLC...
Script exit code: 0
Script result: ditto: can't get real path for source '/VLC.app'
Do you know why please ?
Posted on 11-18-2019 06:55 AM
Hi,
try to change the following lines:
URL to: https://get.videolan.org/vlc/last/macosx/
variable appVol vlc
to VLC
appVol=`find /Volumes -type d -name VLC -maxdepth 1`
optional:
rm -f "/tmp/vlc.dmg"
Posted on 11-19-2019 02:34 AM
I did for this line URL to: https://get.videolan.org/vlc/last/macosx/
I didn't for the others but i tryed an other script which do work :)
It's this one :
mkdir /tmp/downloads
cd /tmp/downloads
CurrentVLC=$(curl "https://get.videolan.org/vlc/last/macosx/" | grep .dmg | grep -v webplugin | grep -v md5 | grep -v sha1 | grep -v sha256 | awk '{print $2}' | awk -F ">" '{print $2}' | tr -d "</a")
curl -L -o vlc.dmg https://get.videolan.org/vlc/last/macosx/$CurrentVLC
hdiutil mount -nobrowse vlc.dmg -mountpoint /Volumes/vlc
rsync -vaz /Volumes/vlc/VLC.app/ /Applications/VLC.app
hdiutil unmount "/Volumes/vlc"
rm vlc.dmg
rm -rf /tmp/downloads
Posted on 02-27-2020 07:15 AM
@cedric67
I used your script, But It does not install the VLC app... maybe.
Instead I am getting the following app installed, which launces nothing.
I looked at the info of this app, but it still has no information. Any ideas?
Some devices have 2.2.4 and we are attempting to update those devices with 3.0.8, while others have nothing installed. For those devices, I created a new 3.0.8 pkg using JAMF Composer, but that fails with an error about the signature. Both Catalina and Mojave OS and multiple devices.
Any help is much appreciated.
Posted on 02-27-2020 07:46 AM
This is what we used and set it to run once a mount on all device that had VLC installed.
#!/bin/bash
mkdir /tmp/downloads
cd /tmp/downloads
# Installing VLC Player
CurrentVLC=$(curl "http://get.videolan.org/vlc/last/macosx/" | grep .dmg | grep -v webplugin | grep -v md5 | grep -v sha1 | grep -v sha256 | awk '{print $2}' | awk -F ">" '{print $2}' | tr -d "</a")
curl -L -o vlc.dmg http://get.videolan.org/vlc/last/macosx/$CurrentVLC
hdiutil mount -nobrowse vlc.dmg -mountpoint /Volumes/vlc
rsync -vaz /Volumes/vlc/VLC.app/ /Applications/VLC.app
hdiutil unmount "/Volumes/vlc"
rm vlc.dmg
rm -rf /tmp/downloads
Posted on 02-27-2020 09:42 AM
So I tweaked the script above and it is now working without fail.
!/bin/bash
mkdir /tmp/downloads
cd /tmp/downloads
Installing VLC Player
*CurrentVLC=$(curl "https://get.videolan.org/vlc/last/macosx/" | grep .dmg | grep -v webplugin | grep -v md5 | grep -v sha1 | grep -v sha256 | awk '{print $2}' | awk -F ">" '{print $2}' | tr -d "</a")
curl -L -o vlc.dmg https://get.videolan.org/vlc/last/macosx/$CurrentVLC
rm -rf /Applications/VLC.app
hdiutil mount -nobrowse vlc.dmg -mountpoint /Volumes/vlc
rsync -vaz /Volumes/vlc/VLC.app/ /Applications/VLC.app
sleep 10
hdiutil unmount "/Volumes/vlc"
rm -rf /tmp/downloads*
See below for changes.
sleep 20 to allow the dmg to load completely.
rm - rf /Applications/VLC.app - which removes the Application before it is reloaded
Commented out rm vlc.dmg - more simple to delete the entire folder /tmp/downloads*
These changes seemed to work on several different devices with Mojave and Catalina. If the device did not have the VLC app it installed it, if it did have any older VLC apps it updated them.
Best of all VLC now works great!
Thanks for the great script @cedric67
Posted on 02-28-2020 06:42 AM
Once again it is failing the install and update to VLC.
It is running through the script in like 3 seconds. Nothing noted in the install logs. While it was executing I tried to go to /tmp/downloads/ it does not locate any such folder. The script is in Shell. It does not appear to be creating the folder, therefore it is skipping a load of steps and errors out. JAMF Log> see the image.
Details do not reveal much, see image
/var/log/install.log says nothing of the script running.
Posted on 08-04-2021 10:07 AM
@bmee we have been using your scrip and it was working great but it has now stopped. Is it still working for you or do you happen to have an update for it? Here is what this log is showing:
12-13-2021 01:44 PM - edited 01-10-2022 03:12 PM
I made some changes:
#!/bin/bash
mkdir /tmp/downloads
cd /tmp/downloads
#Installing VLC Player
CurrentVLC=$(curl "https://get.videolan.org/vlc/last/macosx/" | grep "universal.dmg<" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $1}')
curl -L -o vlc.dmg https://get.videolan.org/vlc/last/macosx/$CurrentVLC
hdiutil mount -nobrowse vlc.dmg -mountpoint /Volumes/vlc
rsync -vaz /Volumes/vlc/VLC.app/ /Applications/VLC.app
sleep 20
hdiutil unmount "/Volumes/vlc"
rm -rf /tmp/downloads*
I also created specific version for Intel and Arm:
Arm64:
#!/bin/bash
mkdir /tmp/downloads
cd /tmp/downloads
#Installing VLC Player
CurrentVLC=$(curl "https://get.videolan.org/vlc/last/macosx/" | grep "arm64.dmg<" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $1}')
curl -L -o vlc.dmg https://get.videolan.org/vlc/last/macosx/$CurrentVLC
hdiutil mount -nobrowse vlc.dmg -mountpoint /Volumes/vlc
rsync -vaz /Volumes/vlc/VLC.app/ /Applications/VLC.app
sleep 20
hdiutil unmount "/Volumes/vlc"
rm -rf /tmp/downloads*
Intel64:
#!/bin/bash
mkdir /tmp/downloads
cd /tmp/downloads
#Installing VLC Player
CurrentVLC=$(curl "https://get.videolan.org/vlc/last/macosx/" | grep "intel64.dmg<" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $1}')
curl -L -o vlc.dmg https://get.videolan.org/vlc/last/macosx/$CurrentVLC
hdiutil mount -nobrowse vlc.dmg -mountpoint /Volumes/vlc
rsync -vaz /Volumes/vlc/VLC.app/ /Applications/VLC.app
sleep 20
hdiutil unmount "/Volumes/vlc"
rm -rf /tmp/downloads*
12-13-2021 01:46 PM - edited 01-10-2022 03:12 PM
I also created a script for an extension attribute:
#!/bin/bash
CurrentVLC=$(curl "https://get.videolan.org/vlc/last/macosx/" | grep "universal.dmg<" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $1}' | tr -d '[a-z]' | sed 's/..$//' | cut -c 2-)
if [ -d /Applications/VLC.app ]; then
VLCversion=$( sudo defaults read /Applications/VLC.app/Contents/info.plist CFBundleVersion )
VLCcheck=$VLCversion
else
VLCcheck="Notinstalled"
fi
if [ "$VLCcheck" == "$CurrentVLC" ]; then #Is VLC up to date?
result="VLCuptoDate"
else result="VLCnotuptoDate"
fi
echo "<result>$result</result>"
Posted on 01-10-2022 03:15 PM
I then created Smart Groups and Policies to install the correct version on computers that were not up to date: