File zoom-appimage.install of Package zoom-appimage
post_install() {
# --- Variables ---
TITLE="Zoom AppImage"
# P A C K A G E V E R S I O N will be replaced to something like 6.0.0.4563 to allow
# specific download but not really needed if 'latest_app' link points
# to the latest AppImage file
pkgver=PACKAGEVERSION
executable=zoom
executable_tag=appimage
launcher=${executable}-${executable_tag}
#architecture=$(uname -m)
architecture=$(lscpu | awk '/Architecture:/{print $2}')
webDir="https://download.opensuse.org/repositories/home:/kimi:/zoom/AppImage/"
APPIMAGE="${webDir}${executable}-latest-${architecture}.AppImage"
# --- End variables ---
# Download Zoom AppImage file to the correct location
echo "Closing ${executable}.AppImage ..."
pkill AppRun.wrapped
killall ${launcher}
echo "wait a few seconds to terminate ${executable}.AppImage ..."
sleep 5s
# Remove traces of unfinished downloads
rm -f /opt/appimages/*.AppImage.part*
# Download Zoom AppImage file to the correct location
file="/opt/appimages/${executable}.AppImage"
minimumsize=90
if [ -f "$file" ]; then
echo "found $file"
actualsize=$(du -k "$file" | cut -f 1)
if [ $actualsize -ge $minimumsize ]; then
#echo size is over $minimumsize kilobytes
echo "appimageupdatetool $file"
sleep 1
appimageupdatetool "$file"
iFiles=`ls /opt/appimages | grep '${executable}.*\.AppImage' | wc -l`
if [ $iFiles -gt 1 ]; then
rm -f $file
mv /opt/appimages/${executable}*.AppImage $file
fi
else
#echo size is under $minimumsize kilobytes
echo "Downloading ${executable}.AppImage..."
sleep 1
wget -O "$file" ${APPIMAGE}
fi
else
echo "Downloading ${executable}.AppImage..."
sleep 1
wget -O "$file" ${APPIMAGE}
fi
if [ -f "$file" ]; then
chmod 755 "$file"
fi
# Users on the system
USERS=$(awk -F':' '{ print $1 }' /etc/passwd)
# echo USERS=$USERS
for user in $USERS; do
# In zoom version 5.17.5 an issue was detected that may reoccur in subsequent releases
# due to mismatch in user configuration files. Those files need to be removed.
if [ -d "/home/$user/.zoom" ]; then
rm -rf /home/$user/.zoom
fi
if [ -d "/home/$user/.cache" ]; then
rm -rf /home/$user/.cache
fi
if [ -d "/home/$user/.config" ]; then
rm -f /home/$user/.config/zoom*
fi
done
}
post_upgrade() {
# --- Variables ---
TITLE="Zoom AppImage"
# P A C K A G E V E R S I O N will be replaced to something like 6.0.0.4563 to allow
# specific download but not really needed if 'latest_app' link points
# to the latest AppImage file
pkgver=PACKAGEVERSION
executable=zoom
executable_tag=appimage
launcher=${executable}-${executable_tag}
#architecture=$(uname -m)
architecture=$(lscpu | awk '/Architecture:/{print $2}')
webDir="https://download.opensuse.org/repositories/home:/kimi:/zoom/AppImage/"
APPIMAGE="${webDir}zoom-latest-${architecture}.AppImage"
# --- End variables ---
# Download Zoom AppImage file to the correct location
echo "Closing ${executable}.AppImage ..."
pkill AppRun.wrapped
killall ${launcher}
echo "wait a few seconds to terminate ${executable}.AppImage ..."
sleep 5s
# Remove traces of unfinished downloads
rm -f /opt/appimages/*.AppImage.part*
# Download Zoom AppImage file to the correct location
file="/opt/appimages/${executable}.AppImage"
minimumsize=90
if [ -f "$file" ]; then
echo "found $file"
actualsize=$(du -k "$file" | cut -f 1)
if [ $actualsize -ge $minimumsize ]; then
#echo size is over $minimumsize kilobytes
echo "appimageupdatetool $file"
sleep 1
appimageupdatetool "$file"
iFiles=`ls /opt/appimages | grep '${executable}.*\.AppImage' | wc -l`
if [ $iFiles -gt 1 ]; then
rm -f $file
mv /opt/appimages/${executable}*.AppImage $file
fi
else
#echo size is under $minimumsize kilobytes
echo "Downloading ${executable}.AppImage..."
sleep 1
wget -O "$file" ${APPIMAGE}
fi
else
echo "Downloading ${executable}.AppImage..."
sleep 1
wget -O "$file" ${APPIMAGE}
fi
if [ -f "$file" ]; then
chmod 755 "$file"
fi
# Users on the system
USERS=$(awk -F':' '{ print $1 }' /etc/passwd)
# echo USERS=$USERS
for user in $USERS; do
# In zoom version 5.17.5 an issue was detected that may reoccur in subsequent releases
# due to mismatch in user configuration files. Those files need to be removed.
if [ -d "/home/$user/.zoom" ]; then
rm -rf /home/$user/.zoom
fi
if [ -d "/home/$user/.cache" ]; then
rm -rf /home/$user/.cache
fi
if [ -d "/home/$user/.config" ]; then
rm -f /home/$user/.config/zoom*
fi
done
}
post_remove() {
# --- Variables ---
executable=zoom
# --- End variables ---
# Remove traces of unfinished downloads
rm -f /opt/appimages/*.AppImage.part*
rm -f /opt/appimages/${executable}.AppImage
# Users on the system
USERS=$(awk -F':' '{ print $1 }' /etc/passwd)
# echo USERS=$USERS
for user in $USERS; do
if [ -d "/home/$user/.zoom" ]; then
rm -rf /home/$user/.zoom
fi
if [ -d "/home/$user/.cache" ]; then
rm -rf /home/$user/.cache
fi
if [ -d "/home/$user/.config" ]; then
rm -f /home/$user/.config/zoom*
fi
done
}