misc/yubioath-desktop: Do not write to $CWD.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2024-07-20 15:34:38 -04:00 committed by Willy Sudiarto Raharjo
parent 27dc338dd1
commit abfda5efc8
No known key found for this signature in database
GPG key ID: 3F617144D7238786

View file

@ -22,6 +22,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20240720 bkw: Modified by SlackBuilds.org:
# Do not write to $CWD. Not only was there a chmod +x, but mounting
# the file loopback without "-o ro" was updating its timestamp.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=yubioath-desktop
@ -68,28 +72,30 @@ mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
# Make the Appimage executable
chmod 755 $CWD/$PRGNAM-$VERSION-linux.AppImage
mkdir -p $PRGNAM-$VERSION/mnt
cd $PRGNAM-$VERSION
cp $CWD/$PRGNAM-$VERSION-linux.AppImage .
chmod +x $PRGNAM-$VERSION-linux.AppImage
# Get appimage mount offset
MOUNT_OFFSET=$( $CWD/$PRGNAM-$VERSION-linux.AppImage --appimage-offset )
MOUNT_OFFSET=$( ./$PRGNAM-$VERSION-linux.AppImage --appimage-offset )
# Mount the appimage so we can extract the .desktop and icon files.
mkdir $PRGNAM-$VERSION
mount -o loop -o offset=$MOUNT_OFFSET $CWD/$PRGNAM-$VERSION-linux.AppImage $TMP/$PRGNAM-$VERSION
mount -o ro,loop -o offset=$MOUNT_OFFSET $CWD/$PRGNAM-$VERSION-linux.AppImage $TMP/$PRGNAM-$VERSION/mnt
# Add .desktop and icon to KDE/XFCE-menus
mkdir -p $PKG/usr/share/applications/ $PKG/usr/share/pixmaps/
cp $PRGNAM-$VERSION/com.yubico.yubioath.desktop ${PKG}/usr/share/applications/${PRGNAM}.desktop
cp $PRGNAM-$VERSION/com.yubico.yubioath.svg ${PKG}/usr/share/pixmaps/com.yubico.yubioath.svg
cp mnt/com.yubico.yubioath.desktop ${PKG}/usr/share/applications/${PRGNAM}.desktop
cp mnt/com.yubico.yubioath.svg ${PKG}/usr/share/pixmaps/com.yubico.yubioath.svg
# Unmount appimage
umount $TMP/$PRGNAM-$VERSION
rmdir $TMP/$PRGNAM-$VERSION
umount mnt
cd $TMP
rm -rf $TMP/$PRGNAM-$VERSION
# Copy appimage to package-location
mkdir -p $PKG/usr/bin/
cp $CWD/$PRGNAM-$VERSION-linux.AppImage $PKG/usr/bin/$PRGNAM
install -m0755 -oroot -groot $CWD/$PRGNAM-$VERSION-linux.AppImage $PKG/usr/bin/$PRGNAM
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc