Skip to content

Commit

Permalink
fix: Update MacOSX packaging to use "com.teclib.glpi-agent" as AppID …
Browse files Browse the repository at this point in the history
…and service identifier
  • Loading branch information
g-bougard committed Nov 22, 2023
1 parent c3d31cf commit 4643fd3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ toolbox:
injector:
* fix #537: Make -x, --xml-ua & --json-ua options equivalent and update help text

packaging:
* Update MacOSX packaging to use "com.teclib.glpi-agent" as AppID and service identifier

1.6.1 Fri, 17 Nov 2023

core:
Expand Down
12 changes: 6 additions & 6 deletions contrib/macosx/glpi-agent-packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ cat >pkg/build-info.plist <<-BUILD_INFO
<key>distribution_style</key>
<true/>
<key>identifier</key>
<string>org.glpi-project.glpi-agent</string>
<string>com.teclib.glpi-agent</string>
<key>install_location</key>
<string>/</string>
<key>name</key>
Expand Down Expand Up @@ -518,20 +518,20 @@ cat >pkg/Distribution.xml <<-CUSTOM
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="2">
<title>GLPI-Agent $VERSION ($ARCH)</title>
<pkg-ref id="org.glpi-project.glpi-agent" version="$VERSION" onConclusion="none">$PKG</pkg-ref>
<pkg-ref id="com.teclib.glpi-agent" version="$VERSION" onConclusion="none">$PKG</pkg-ref>
<license file="License.txt" mime-type="text/plain" />
<background file="background.png" uti="public.png" alignment="bottomleft"/>
<background-darkAqua file="background.png" uti="public.png" alignment="bottomleft"/>
<domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
<options customize="never" require-scripts="false" hostArchitectures="$ARCH"/>
<choices-outline>
<line choice="default">
<line choice="org.glpi-project.glpi-agent"/>
<line choice="com.teclib.glpi-agent"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="org.glpi-project.glpi-agent" visible="false">
<pkg-ref id="org.glpi-project.glpi-agent"/>
<choice id="com.teclib.glpi-agent" visible="false">
<pkg-ref id="com.teclib.glpi-agent"/>
</choice>
<os-version min="$MACOSX_DEPLOYMENT_TARGET" />
</installer-gui-script>
Expand All @@ -557,7 +557,7 @@ cat >pkg/payload/Applications/GLPI-Agent/Contents/Info.plist <<-INFO_PLIST
<key>CFBundleExecutable</key>
<string>glpi-agent</string>
<key>CFBundleIdentifier</key>
<string>org.glpi-project.glpi-agent</string>
<string>com.teclib.glpi-agent</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
16 changes: 8 additions & 8 deletions contrib/macosx/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ if [ "$DEST" != "/" ]; then
fi

echo "Only Tiger or newer OS supported, using LaunchDaemons plists"
TMPPLIST="$(touch org.glpi-project.glpi-agent.plist && echo org.glpi-project.glpi-agent.plist || mktemp -t org.glpi-project.glpi-agent)"
TMPPLIST="$(touch com.teclib.glpi-agent.plist && echo com.teclib.glpi-agent.plist || mktemp -t com.teclib.glpi-agent)"
TPATH="/Library/LaunchDaemons"
cat >"$TMPPLIST" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.glpi-project.glpi-agent</string>
<string>com.teclib.glpi-agent</string>
<key>ProgramArguments</key>
<array>
<string>$INSTALL_PATH/bin/glpi-agent</string>
Expand All @@ -65,17 +65,17 @@ cat >"$TMPPLIST" <<PLIST
</plist>
PLIST
if [ -s "$TMPPLIST" ]; then
sudo rm -f $TPATH/org.glpi-project.glpi-agent.plist
sudo cp -f "$TMPPLIST" $TPATH/org.glpi-project.glpi-agent.plist
sudo chown root:wheel $TPATH/org.glpi-project.glpi-agent.plist
sudo chmod 644 $TPATH/org.glpi-project.glpi-agent.plist
sudo rm -f $TPATH/com.teclib.glpi-agent.plist
sudo cp -f "$TMPPLIST" $TPATH/com.teclib.glpi-agent.plist
sudo chown root:wheel $TPATH/com.teclib.glpi-agent.plist
sudo chmod 644 $TPATH/com.teclib.glpi-agent.plist
rm -f "$TMPPLIST"

echo 'Loading Service'
sudo launchctl load $TPATH/org.glpi-project.glpi-agent.plist
sudo launchctl load $TPATH/com.teclib.glpi-agent.plist

echo 'Starting Service'
sudo launchctl start org.glpi-project.glpi-agent
sudo launchctl start com.teclib.glpi-agent
else
echo "Failed to create service"
fi
Expand Down
7 changes: 7 additions & 0 deletions contrib/macosx/scripts/preinstall
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ DEST="$2"
INSTALL_PATH="${DEST%/}/Applications/GLPI-Agent"

# Stop service and unload plist file if present
# Case for glpi-agent > 1.6.1
if [ -e /Library/LaunchDaemons/com.teclib.glpi-agent.plist ]; then
echo "Stopping service"
sudo launchctl stop com.teclib.glpi-agent
sudo launchctl unload /Library/LaunchDaemons/com.teclib.glpi-agent.plist
fi
# Case for glpi-agent <= 1.6.1
if [ -e /Library/LaunchDaemons/org.glpi-project.glpi-agent.plist ]; then
echo "Stopping service"
sudo launchctl stop org.glpi-project.glpi-agent
Expand Down
8 changes: 4 additions & 4 deletions contrib/macosx/scripts/uninstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ INSTALLPATH="`pwd`"
cd ..

echo "Stopping and unloading service"
sudo launchctl stop org.glpi-project.glpi-agent
sudo launchctl unload /Library/LaunchDaemons/org.glpi-project.glpi-agent.plist
sudo launchctl stop com.teclib.glpi-agent
sudo launchctl unload /Library/LaunchDaemons/com.teclib.glpi-agent.plist

# Still wait until process has been stopped
read PID XXX <<<`ps -ec -o pid,command | grep glpi-agent`
Expand Down Expand Up @@ -37,8 +37,8 @@ done <<-FILES
$INSTALLPATH
/var/log/glpi-agent.log
/usr/local/bin/dmidecode
/Library/LaunchDaemons/org.glpi-project.glpi-agent.plist
/Library/LaunchDaemons/com.teclib.glpi-agent.plist
FILES
# Unregister package
sudo pkgutil --forget org.glpi-project.glpi-agent $INSTALLPATH
sudo pkgutil --forget com.teclib.glpi-agent $INSTALLPATH

0 comments on commit 4643fd3

Please sign in to comment.