WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Script: place .png + .desktop file [into foxit_reader]  (Read 1267 times)

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Script: place .png + .desktop file [into foxit_reader]
« on: October 29, 2010, 07:18:22 PM »
This is a script to place the .desktop and .png file into an existing extension. Did I miss someone else's tools for this??? Good for finishing up the extension building process.

Requires squashfs-tools extension.

Attached [log in] are a foxit reader icon + desktop file, as that was my first target.

Code: [Select]
#!/bin/sh

# place icon file into EXT.tcz extension
# requires EXT.desktop, EXT.png, and EXT.tcz
# dentonlt, October 2010

if [ -z "$1" ]; then
echo "
setup-icon.sh
Tool for placing .desktop and .png files into Tiny Core extension.
dentonlt 20101030

Usage: setup-icon.sh EXTENSIONNAME

setup-icon.sh will create the pixmaps and application directories if
they don't exist, and will put your png and desktop files into those
folders. The script needs:

EXTENSIONNAME.tcz
EXTENSIONNAME.png
EXTENSIONNAME.desktop

Do not this on a mounted extension. Reboot without the extension, or
copy the extension file into a temporary directory."
exit 1
fi

if [ ! -e "/usr/local/tce.installed/squashfs-tools-4.x" ]; then
TCEDIR="`cat /opt/.tce_dir`/optional"
if [ ! -e ""$TCEDIR"/squashfs-tools-4.x.tcz" ]; then
echo "I can't find "$TCEDIR"/squashfs-tools-4.x. Use appbrowser to get it."
exit 1
fi
tce-load -i "$TCEDIR"/squashfs-tools-4.x
fi


[ ! -e ""$1".tcz" ] && echo "I need "$1".tcz" && exit 1
[ ! -e ""$1".desktop" ] && echo "I need "$1".desktop" && exit 1
[ ! -e ""$1".png" ] && echo "I need "$1".png" && exit 1

if [ -e "/usr/local/tce.installed/"$1"" ]; then

read -p "$1 is currently installed. Do not modify the extension in place! Continue? y/n" ANS

[ "$ANS" != "y" ] && [ "$ANS" != "Y" ] && exit 1
fi

#unsquash
unsquashfs "$1".tcz

#set up the menu entry + wbar icon
mkdir -p squashfs-root/usr/local/share/applications
cp -f "$1".desktop squashfs-root/usr/local/share/applications

#place the icon image
mkdir -p squashfs-root/usr/local/share/pixmaps
cp -f "$1".png squashfs-root/usr/local/share/pixmaps

#make new extension
rm "$1".tcz
mksquashfs squashfs-root "$1".tcz

#remove squash folder
rm -rf squashfs-root

echo "Done."
« Last Edit: October 29, 2010, 07:29:21 PM by dentonlt »