11#! /bin/bash
22
33# =======================================
4- # Copyright 2022 AT&T
4+ # Copyright 2022, 2023 AT&T
55#
66# Licensed under the Apache License, Version 2.0 (the "License");
77# you may not use this file except in compliance with the License.
1818
1919# =======================================
2020# vo_dependency_installer.sh
21- # version 1.0.0.4
21+ VERSION= " 1.0.1.0 "
2222#
2323# Howto use this script:
2424# From your browser, select 'Save' and choose or create an empty folder. Make sure the script has the extension '.sh'.
2525# Safari defaults to '.txt' so be sure the change it.
2626#
2727# Open a terminal in the folder containing the script.
2828# Launch the script with './vo_dependency_installer.sh'
29- # At one point you will be prompted for your sudo password
30- # There are two instances of 'sudo make install'
29+ # At one point you will be prompted for your sudo password,
30+ # this will be to completely remove any old version of ifuse
31+ # DO NOT LAUNCH THIS INSTALL USING SUDO
3132# =======================================
3233#
3334# This bash shell script will install needed dependancies
3738#
3839# It is advised that the computer is backed up, and important data is safely stored.
3940#
40- # The dependancies that are required include some 'HEAD' versions, which are not yet
41- # considered to be stable. 'libimobiledevice' is installed under HEAD, which may bring
42- # other dependancies, possibly also HEAD versions.
43- # Some of the depenancies do not have functional formula to allow 'brew' to install them,
44- # and there for must be cloned from github and compiled.
45- #
46- # These include 'ifuse' and 'libimobiledevice-glue'
47- # see:
48- # git clone https://github.com/libimobiledevice/ifuse.git
49- # git clone https://github.com/libimobiledevice/libimobiledevice-glue.git
50- #
51- # There are some basic requirements before this script can be run.
41+ # There are some basic requirements before this script should be run.
5242# 1 You must have and run this under an Admin account, do not run under 'sudo'
53- # 1 macOS 12.6 .1
54- # 2 Xcode 14.1
55- # 3 brew (aka HomeBrew https://brew.sh)
43+ # 2 macOS 13.4 or 13.4 .1
44+ # 3 Xcode 14.3 .1
45+ # 4 brew (aka HomeBrew https://brew.sh)
5646#
5747# Testing:
5848# This script has been tested on Macbook Pro intel and M1 machines running Monterey 12.6 and Ventura early December 2022
5949# Ventura 13.2.1 Mar 31, 2023
50+ # Ventura 13.4.1, Intel & M1 July 18 2023
6051#
6152# =======================================
6253function init_brew (){
7061
7162 # make sure we can compile
7263 brew install cmake
64+ brew install automake
7365 brew install autogen
7466 brew install autoconf
7567
@@ -88,61 +80,13 @@ echo ">>>>> uninstall <<<<<"
8880 brew uninstall --ignore-dependencies libplist 2> /dev/null
8981 brew uninstall --ignore-dependencies libimobiledevice 2> /dev/null
9082 brew uninstall --ignore-dependencies ifuse 2> /dev/null
91- }
92-
93- # =======================================
94- function compile_libimobiledevice-glue () {
95- echo " "
96- echo " >>>>> compile_libimobiledevice-glue <<<<<"
97-
98- # install dependencies
99- # 1 libplist non-head version
100-
101- brew install libplist
102-
103- if [ " ${PWD##*/ } " = " libimobiledevice-glue" ]; then
104- if [ " ${ARCH_NAME} " = " x86_64" ]; then
105- touch " __compile_x86"
106- echo " ./autogen.sh --prefix=/usr/local"
107- ./autogen.sh --prefix=/usr/local
108- else
109- touch " __compile_aarch"
110- echo " ./autogen.sh --prefix=/opt/homebrew"
111- ./autogen.sh --prefix=/opt/homebrew
112- fi
113- make
114- echo " sudo make install"
115- sudo make install
116-
117- if [ " ${ARCH_NAME} " = " x86_64" ]; then
118- # For Intel / x86-64 machines -
119- ln -s /usr/local/lib/pkgconfig/libimobiledevice-glue-1.0.pc /usr/local/opt/libplist/lib/pkgconfig/libimobiledevice-glue-1.0.pc
120- else
121- # For M1 / aach64 machines -
122- ln -s /opt/homebrew/lib/pkgconfig/libimobiledevice-glue-1.0.pc /opt/homebrew/opt/libplist/lib/pkgconfig/libimobiledevice-glue-1.0.pc
123- fi
124-
125- else
126- echo " libimobiledevice-glue failure, in wrong path: ` pwd` "
127- exit_install
128- fi
129- }
130-
131- # =======================================
132- function install_libimobiledevice () {
133- echo " "
134- echo " >>>>> install_libimobiledevice <<<<<"
135-
136- brew uninstall --ignore-dependencies libimobiledevice 2> /dev/null
137-
138- brew install --HEAD libimobiledevice
139- brew unlink libimobiledevice && brew link libimobiledevice
83+ brew uninstall --ignore-dependencies openssl 2> /dev/null
84+ sudo rm ` which ifuse` 2> /dev/null
14085}
14186
14287# =======================================
14388# install ifuse
144- # plus openssl
145- # on intel openssl requires non-head version of libimobiledevice
89+ # plus openssl
14690function install_ifuse () {
14791echo " "
14892echo " >>>>> install_ifuse <<<<<"
@@ -151,11 +95,8 @@ echo ">>>>> install_ifuse <<<<<"
15195 # 1 libimobiledevice non-head version for openssl
15296 # 2 openssl
15397
154- if [ " ${ARCH_NAME} " = " x86_64" ]; then
155- brew install libimobiledevice
156- else
157- install_libimobiledevice
158- fi
98+ brew install libimobiledevice
99+
159100 brew install openssl
160101
161102 LISTING=$( brew list openssl)
@@ -194,8 +135,14 @@ echo ">>>>> install_ifuse <<<<<"
194135 # now compile ifuse
195136 ./autogen.sh
196137 make
197- echo " sudo make install"
198- sudo make install
138+
139+ if [ " $ARCH_NAME " == " x86_64" ]; then
140+ echo " make install"
141+ make install
142+ else
143+ echo " sudo make install"
144+ sudo make install
145+ fi
199146}
200147
201148# =======================================
@@ -206,42 +153,29 @@ echo "====>>>>> do_install <<<<<===="
206153echo " "
207154
208155 echo " Archetecture $ARCH_NAME "
209-
156+ echo " $0 $VERSION "
210157 echo " ============================ prepare ============================"
211158 if [[ -d /Library/PreferencePanes/macFUSE.prefPane ]]; then
212159 init_brew
213160 do_uninstall
161+
162+ echo " ============================ compile iFuse ============================"
163+ rm -fr ifuse
164+ git clone https://github.com/libimobiledevice/ifuse.git
165+ # unzip ../bu/ifuse.zip -d ./ ; rm -fr __MACOSX
166+ if [ -d ifuse ]; then
167+ ( cd ifuse && install_ifuse )
168+ else
169+ echo " clone: failed to git clone https://github.com/libimobiledevice/ifuse.git" >> error
170+ exit_install
171+ fi
172+
214173 else
215174 echo " MacFuse not detected"
216175 echo " To install, visit https://osxfuse.github.io"
176+ exit_install
217177 fi
218178
219- echo " ============================ libimobiledevice-glue ============================"
220- rm -fr libimobiledevice-glue
221- git clone https://github.com/libimobiledevice/libimobiledevice-glue.git
222- # unzip ../bu/libimobiledevice-glue.zip -d ./ ; rm -fr __MACOSX
223- if [ -d libimobiledevice-glue ]; then
224- ( cd libimobiledevice-glue && compile_libimobiledevice-glue )
225- else
226- echo " clone: failed to git clone https://github.com/libimobiledevice/libimobiledevice-glue.git" >> error
227- exit_install
228- fi
229-
230- echo " ============================ compile iFuse ============================"
231- rm -fr ifuse
232- git clone https://github.com/libimobiledevice/ifuse.git
233- # unzip ../bu/ifuse.zip -d ./ ; rm -fr __MACOSX
234- if [ -d ifuse ]; then
235- ( cd ifuse && install_ifuse )
236- else
237- echo " clone: failed to git clone https://github.com/libimobiledevice/ifuse.git" >> error
238- exit_install
239- fi
240-
241- echo " ============================ libimobiledevice HEAD version ============================"
242- if [ " ${ARCH_NAME} " = " x86_64" ]; then
243- install_libimobiledevice
244- fi
245179}
246180# =======================================
247181function exit_install (){
@@ -319,40 +253,53 @@ function machine_precheck (){
319253 if [[ ` which brew` == " " ]]; then
320254 echo " brew is not installed"
321255 echo " To install, please visit: https://brew.sh"
322- exit_install
256+ CHECK=" brew is not installed, To install, please visit: https://brew.sh"
257+ return
323258 else
324259 BREW_CONFIG=` brew config`
325260 fi
326261
262+ if [[ -d /Library/PreferencePanes/macFUSE.prefPane ]]; then
263+ echo " MacFuse is installed"
264+ else
265+ echo " MacFuse not detected"
266+ echo " To install, visit https://osxfuse.github.io"
267+ CHECK=" fail:MacFuse not detected"
268+ fi
327269
328- # macOS: 13.2.1-arm64
329- regex=" (macOS): ([0-9]*)\.([0-9]*)\.([0-9]*)\-"
330- check_version " $BREW_CONFIG " " $regex " macOS 13 2 1 13.2.1
270+ # macOS: 13.2.1-arm64
271+ regex=" (macOS): ([0-9]*)\.([0-9]*)\.([0-9]*)\-"
272+ check_version " $BREW_CONFIG " " $regex " macOS 13 2 1 13.2.1
331273
332- # CLT: 14.2.0.0.1.1668646533
333- regex=" (CLT): ([0-9A-Za-z/]*)\.([0-9]*)\.([0-9]*)"
334- check_version " $BREW_CONFIG " " $regex " CLT 14 2 0 14.2.0 " CLT: 14.2 .0.0.1.1668646533"
274+ # CLT: 14.2.0.0.1.1668646533
275+ regex=" (CLT): ([0-9A-Za-z/]*)\.([0-9]*)\.([0-9]*)"
276+ check_version " $BREW_CONFIG " " $regex " CLT 14 3 0 14.2.0 " CLT: 14.3 .0.0.1.1668646533"
335277
336- # Xcode: 14.1
337- regex=" (Xcode): ([0-9]*)\.([0-9]*)"
338- check_version " $BREW_CONFIG " " $regex " Xcode 14 1 " " " Xcode: 14.1 "
339- echo $CHECK
278+ # Xcode: 14.1
279+ regex=" (Xcode): ([0-9]*)\.([0-9]*)"
280+ check_version " $BREW_CONFIG " " $regex " Xcode 14 3 " " " Xcode: 14.3 "
281+ echo $CHECK
340282
341- if [[ ${CHECK} = " fail" * ]] ; then
342- if [[ $CHECK == * " CLT" * ]] ; then
343- echo " verify active developer directory with 'xcode-select -p'"
344- echo " use 'xcode-select --install' to install the correct commandline tools for your Xcode installation"
283+ if [[ ${CHECK} = " fail" * ]] ; then
284+ if [[ $CHECK == * " CLT" * ]] ; then
285+ echo " verify active developer directory with 'xcode-select -p'"
286+ echo " use 'xcode-select --install' to install the correct commandline tools for your Xcode installation"
287+ fi
288+ else
289+ echo " ready to proceed\!"
345290 fi
346- else
347- echo " ready to proceed\!"
348- fi
349291
350292}
351293
352294# -----------------------------------------------------
353- # vo_installer .sh
295+ # vo_dependency_installer .sh
354296# -----------------------------------------------------
355297
298+ if [ " ` id -u` " = " 0" ]; then
299+ echo " vo_dependency_installer.sh cannot be launched under sudo or from the root user"
300+ exit 0
301+ fi
302+
356303ARCH_NAME=` uname -m`
357304PTH=` pwd | grep " " `
358305if [ ! " $PTH " = " " ]; then
0 commit comments