Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to detect Office 2016 or 2019 and change app id #12

Open
Coros opened this issue Feb 3, 2020 · 0 comments
Open

Add function to detect Office 2016 or 2019 and change app id #12

Coros opened this issue Feb 3, 2020 · 0 comments

Comments

@Coros
Copy link

Coros commented Feb 3, 2020

I've added the following function to my fork of the script to make it work with both Office 2016 and Office 2019.

function GetInstalledVersion() {
	local INST_VERSION=$(defaults read "$1"/Contents/Info.plist CFBundleShortVersionString)
	local INST_MAJOR_VERSION=$(echo $INST_VERSION | cut -d "." -f 1 )
	local INST_MINOR_VERSION=$(echo $INST_VERSION | cut -d "." -f 2 )
	
	if (( $INST_MAJOR_VERSION >= 16 )) && (( $INST_MINOR_VERSION < 17 )) ; then
		local APPID_VER="15"
	elif (( $INST_MAJOR_VERSION >= 16 )) && (( $INST_MINOR_VERSION >= 17 )) ; then
		local APPID_VER="2019"
	else
		Debug "Unidentified version: $INST_VERSION"
		exit 1
	fi

	echo "$APPID_VER"
}

I've also updated each update call to look like:

if [ "$UPDATE_WORD" == "true" ]; then
	Debug "Going for Word update"
	APPID_WORD="MSWD"
	APPID_WORD_FMTD=$(echo $APPID_WORD)$(GetInstalledVersion "$PATH_WORD")
	Debug "APPID_WORD_FMTD: APPID_WORD_FMTD"
	RegisterApp "$PATH_WORD" "$APPID_WORD_FMTD"
	SetTargetVersion "$VERSION_WORD"
	PerformUpdate "$APPID_WORD_FMTD" "$TARGET_VERSION"
else
	Debug "Update for Word disabled"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant