Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: Jason W on April 30, 2011, 08:40:33 PM
-
This creates an Acrobat Reader 9.4.0 extension in your tce directory.
Install with the command:
tce-load -i `cat /opt/.tce_dir`/acroread-9.4.0.tcz
#!/bin/sh
# To fetch and build an Acrobat Reader extension. It is far
# preferable to change the "$SRCDIR" variable to a mounted storage
# device as this will take gobs of RAM.
# Taken from the Arch Linux pkgbuild.
if [ "$USER" == "root" ]; then
echo "Do not need to run as root. Exiting.."
exit 1
fi
if [ ! -f /usr/local/tce.installed/glibc_gconv ]; then
echo "Install glibc_gconv.tcz before proceeding."
exit 1
fi
if [ ! -f /usr/local/tce.installed/openssl-0.9.8 ]; then
echo "Install openssl-0.9.8.tcz before proceeding."
exit 1
fi
if [ ! -f /usr/local/tce.installed/gtk2 ]; then
echo "Install gtk2.tcz before proceeding."
exit 1
fi
if [ ! -f /usr/local/tce.installed/libcups ]; then
echo "Install libcups.tcz before proceeding."
exit 1
fi
if [ ! -f /usr/local/tce.installed/squashfs-tools-4.x ]; then
echo "Install squashfs-tools-4.x.tcz before proceeding."
exit 1
fi
NAME=acroread
VERSION=9.4.0
DOWNLOAD=ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/"$VERSION"/enu/
SOURCE=AdbeRdr9.4-1_i486linux_enu.tar.bz2
MD5SUM=dd7a47695fb149c09dcda65c754708cb
SRCDIR=/mnt/sda1/acroread123
TMPDIR="$SRCDIR"/"$NAME"21654
PKG="$TMPDIR"/pkg
TCEDIR="`cat /opt/.tce_dir`/optional"
if [ ! -d "$PKG" ]; then
sudo mkdir -p "$PKG"
sudo chown -R tc:staff "$SRCDIR"
fi
cd "$SRCDIR"
if [ -e "$SOURCE" ]; then
if [ $(md5sum "$SOURCE" | cut -c1-32) != "$MD5SUM" ]; then
sudo rm -r "$SOURCE"
fi
fi
if [ ! -e "$SOURCE" ]; then
wget -c "$DOWNLOAD"/"$SOURCE"
fi
if [ $(md5sum "$SOURCE" | cut -c1-32) = "$MD5SUM" ]; then
echo "md5sum passed."
else
echo "Download failed. aborting"
exit 1;
fi
tar xjvf "$SOURCE"
cd "$SRCDIR"/AdobeReader
tar -xf COMMON.TAR
tar -xf ILINXR.TAR
cd Adobe/Reader9
mkdir -p "$PKG"/usr/local/lib/Acroread
cp -a * "$PKG"/usr/local/lib/Acroread
mkdir -p "$PKG"/usr/local/bin
ln -s /usr/local/lib/Acroread/bin/acroread "$PKG"/usr/local/bin/acroread
echo "Installing Broswer Plugin..."
mkdir -p "$PKG"/usr/local/lib/mozilla/plugins
ln -s /usr/local/lib/Acroread/Browser/intellinux/nppdf.so "$PKG"/usr/local/lib/mozilla/plugins/nppdf.so
echo "Installing Icon Resource..."
install -D -m644 Resource/Support/AdobeReader.desktop \
"$PKG"/usr/local/share/applications/acroread-9.4.0.desktop
install -D -m644 Resource/Icons/64x64/AdobeReader9.png \
"$PKG"/usr/local/share/pixmaps/acroread-9.4.0.png
sed -i 's:Icon=AdobeReader9:Icon=acroread-9.4.0:g' "$PKG"/usr/local/share/applications/acroread-9.4.0.desktop
echo "X-FullPathIcon=/usr/local/share/pixmaps/acroread-9.4.0.png" >> "$PKG"/usr/local/share/applications/acroread-9.4.0.desktop
echo "Installing License..."
install -D -m644 Reader/Legal/en_US/License.txt \
"$PKG"/usr/local/share/licenses/acroread/License.txt
cd "$TMPDIR"
sudo mksquashfs pkg/ "$TCEDIR"/"$NAME"-"$VERSION".tcz -noappend
sudo rm -rf "$TMPDIR"
cd ..
sudo rm -rf "$SRCDIR"/AdobeReader
echo "gtk2.tcz" > "$TCEDIR"/"$NAME"-"$VERSION".tcz.dep
echo "glibc_gconv.tcz" >> "$TCEDIR"/"$NAME"-"$VERSION".tcz.dep
echo "libcups.tcz" >> "$TCEDIR"/"$NAME"-"$VERSION".tcz.dep
echo "squashfs-tools-4.x.tcz" >> "$TCEDIR"/"$NAME"-"$VERSION".tcz.dep
echo "openssl-0.9.8.tcz" >> "$TCEDIR"/"$NAME"-"$VERSION".tcz.dep
echo ""$NAME"-"$VERSION".tcz is now in "$TCEDIR" ready to be installed."
-
into which folder should I put the script in?
Is the result an extension?
Thank you
-
It can be run from anywhere. But edit the SRCDIR variable to decide where to download and make the package, it will take up a lot of working space. The extension will be made in your existing and in use tce/optional directory ready to be loaded with tce-load, or added to onboot or ondemand.
-
Hi Jason!
Didn't find this script until now. I used it and the Acrobat Reader works excellent. Many thanks for all the things you do for the community!
Have fun making TC more polished and useful,
meo
-
Hi Jason!
Tried the script on the new TC 4.0 rc1 and it worked like a charm. Thanks for making this script!!!
Have fun in all your work for the TC community,
meo
-
Jason, you as other users of the forum produce amazing script, I wonder why not put them on the repository rather than rather the use to those who make a careful search on the forum.
You could use the new features in 4.0 and put them with the "script" tag, that'd be great.
I think your products are comparable to any other package in terms of utility (like Flash)
-
Thanks, I will consider polishing this one up and putting it in the repo. A fetch and install script for acrobat, like flash, is reasonable, though in general I like to keep scripts here and not in the repo.
-
Thanks Jason, this really works well. I encourage you to find a way to put it in the repo. Or, if not that, maybe there should be a place just for Really Useful Scripts.
I've updated it to download the latest version. Here are the things I changed:
Downloads AdbeRdr9.4.6-1_i486linux_enu.tar.bz2
Updated md5sum to match
Changed icon to acroread-9.4.6.png
Changed desktop file to acroread-9.4.6.desktop
changed openssl to version 1.0.0
I think that's about it. I've attached the file.
-
Hi guys!
Tried this script in the new TC 4.2 but with no success. The script might need an update?
Have fun extending the limits of TC,
meo
-
Yeah, there are a lot of scripts that I am sure need updating due to the change from /opt/.tce_dir to /etc/sysconfig/tcedir. Something like this would work to keep it compatible with both pre-4.2 and post-4.2 releases:
if readlink /etc/sysconfig/tcedir >/dev/null; then
TCEDIR=`readlink /etc/sysconfig/tcedir`
elif [ -f /opt/.tce_dir ]; then
TCEDIR=`cat /opt/.tce_dir`
fi
-
Hi Jason!
Where would those lines be inserted into the script?
Have fun helping out in the TC community,
meo
-
I attached a hopefully fixed version.
-
Hi again Jason!
It worked great, thanks! The only snag is that it appeared in the tce directory instead of tce/optional but I just moved it. Thanks again I use it a lot!!!
Have fun widening the functionality of TC,
meo
-
Ok, I corrected the above attachment, should work.
-
Hi again Jason!
Thanks a lot! I really appreciate your work and willingness to help out. Thanks again!
Have fun keeping up your good work,
meo
-
I attached a hopefully fixed version.
I tried the script but I'm not gone, just created. dep in ./optional
tc@box:/mnt/sda6/AcrobatReadnerd$ ./get_acroread
mkdir: can't create directory '/mnt/sda1/acroread123/': Read-only file system
chown: /mnt/sda1/acroread123: No such file or directory
./get_acroread: cd: line 60: can't cd to /mnt/sda1/acroread123
Connecting to ftp.adobe.com (192.150.16.26:21)
AdbeRdr9.4.6-1_i486l 100% |*******************************| 55768k 0:00:00 ETA
md5sum passed.
AdobeReader/
AdobeReader/COMMON.TAR
AdobeReader/ILINXR.TAR
AdobeReader/INSTALL
AdobeReader/ReadMe.htm
./get_acroread: cd: line 80: can't cd to /mnt/sda1/acroread123/AdobeReader
tar: can't open 'COMMON.TAR': No such file or directory
tar: can't open 'ILINXR.TAR': No such file or directory
./get_acroread: cd: line 83: can't cd to Adobe/Reader9
mkdir: can't create directory '/mnt/sda1/acroread123/': Read-only file system
cp: can't create '/mnt/sda1/acroread123/acroread21654/pkg/usr/local/lib/Acroread/AdbeRdr9.4.6-1_i486linux_enu.tar.bz2': Path does not exist
cp: can't create directory '/mnt/sda1/acroread123/acroread21654/pkg/usr/local/lib/Acroread/AdobeReader': No such file or directory
cp: can't create '/mnt/sda1/acroread123/acroread21654/pkg/usr/local/lib/Acroread/get_acroread': Path does not exist
mkdir: can't create directory '/mnt/sda1/acroread123/': Read-only file system
ln: /mnt/sda1/acroread123/acroread21654/pkg/usr/local/bin/acroread: No such file or directory
Installing Broswer Plugin...
mkdir: can't create directory '/mnt/sda1/acroread123/': Read-only file system
ln: /mnt/sda1/acroread123/acroread21654/pkg/usr/local/lib/mozilla/plugins/nppdf.so: No such file or directory
Installing Icon Resource...
install: can't create directory '/mnt/sda1/acroread123/': Read-only file system
install: can't stat 'Resource/Support/AdobeReader.desktop': No such file or directory
install: can't create directory '/mnt/sda1/acroread123/': Read-only file system
install: can't stat 'Resource/Icons/64x64/AdobeReader9.png': No such file or directory
sed: /mnt/sda1/acroread123/acroread21654/pkg/usr/local/share/applications/acroread-9.4.6.desktop: No such file or directory
./get_acroread: line 108: can't create /mnt/sda1/acroread123/acroread21654/pkg/usr/local/share/applications/acroread-9.4.6.desktop: nonexistent directory
Installing License...
install: can't create directory '/mnt/sda1/acroread123/': Read-only file system
install: can't stat 'Reader/Legal/en_US/License.txt': No such file or directory
./get_acroread: cd: line 113: can't cd to /mnt/sda1/acroread123/acroread21654
Cannot stat source directory "pkg/" because No such file or directory
acroread-9.4.6.tcz is now in /mnt/sdb1/tce/optional ready to be installed.
tc@box:/mnt/sda6/AcrobatReadnerd$
After, in order:
1 I kept the downloaded file
2 I unmount sda1
3 I restart the script but instead of re-use previously downloaded file starts to download again
4 so I gave up :P
-
Attached is a corrected copy, uses /opt by default, does not redownload if source exists.
-
Unfortunately the script does not work yet:
tc@box:/opt$ ls
AdbeRdr9.4.6-1_i486linux_enu.tar.bz2 backgrounds/ bootsync.sh shutdown.sh
alsa/ bootlocal.sh get_acroread tcemirror
tc@box:/opt$ ./get_acroread
--2012-01-10 12:18:27-- ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.6/enu//AdbeRdr9.4.6-1_i486linux_enu.tar.bz2
=> `AdbeRdr9.4.6-1_i486linux_enu.tar.bz2'
Resolving ftp.adobe.com... 192.150.16.26
Connecting to ftp.adobe.com|192.150.16.26|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/adobe/reader/unix/9.x/9.4.6/enu/ ... done.
==> SIZE AdbeRdr9.4.6-1_i486linux_enu.tar.bz2 ... 57106801
==> PASV ... done. ==> RETR AdbeRdr9.4.6-1_i486linux_enu.tar.bz2 ... done.
Length: 57106801 (54M) (unauthoritative)
0% [ ] 50,680 11.2K/s eta 82m 39s ^C
tc@box:/opt$
tc@box:/opt$
tc@box:/opt$ ./get_acroread AdbeRdr9.4.6-1_i486linux_enu.tar.bz2
--2012-01-10 12:18:49-- ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.6/enu//AdbeRdr9.4.6-1_i486linux_enu.tar.bz2
=> `AdbeRdr9.4.6-1_i486linux_enu.tar.bz2'
Resolving ftp.adobe.com... 192.150.16.26
Connecting to ftp.adobe.com|192.150.16.26|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/adobe/reader/unix/9.x/9.4.6/enu/ ... done.
==> SIZE AdbeRdr9.4.6-1_i486linux_enu.tar.bz2 ... 57106801
==> PASV ... done. ==> RETR AdbeRdr9.4.6-1_i486linux_enu.tar.bz2 ... done.
Length: 57106801 (54M) (unauthoritative)
0% [ ] 27,512 16.2K/s ^C
tc@box:/opt$
-
The SRCDIR is /opt/acroread123, not /opt. If you place the tarball in /opt it will be downloaded again, and again. Since the download attempts were cut short with control-C, the source will start downloading again since the source is deleted if it's md5sum does not match up.
It works here, I cannot reproduce.
-
Now is ok :D
Use the relative path to where the script is not a good idea?
-
Actually, that can be done, just change the SRCDIR variable to point to `pwd`, or wherever you want. I picked /opt as everyone has an /opt and it can be mounted. I will ponder on whether to change it to default to `pwd`, but most scripts use a temporary directory as to not clutter /home or wherever the script is located.
-
I do not understand the script, but a solution could be to first search for the files in `pwd` and if it is not in /opt/acroread123, after that make all operations there, as already is.
You could also make possible the selection of files through an argument after the command, and if not, tell to the user where the file will be downloaded.
Anyway thanks again, yesterday acrobat helped me a lot (especially for print settings)
-
Actually, the current working directory makes sense and is the path of least surprise. Want to download to /tmp, the cd to /tmp and run the script. I will add that in when I get a chance.
-
Hello, I am using 4.2 and I am still having trouble with this. When I try to execute the file with terminal I get a message Cant open file. If anybody could help I would appreciate it.
-
You've made the script executable?
chmod 777 . /get_acroread
-
I had not done that but it is still giving the "couldn't open file" error, its directory is /home/tc/get_acroread.sh so I have been typing sh /home/tc/get_acroread.sh in terminal and get message " sh: can't open '/home/tc/get_acroread.sh' "
any ideas?
-
Hi Techmaster317
Is the file called get_acroread.sh or get_acroread?
-
I thought I had it working because when I left off the .sh in the file name it executes but now it starts to download something and then I get a message "Download failed, aborting" now what?
-
Ok I tried it again and both times it gives the download failed message at 59% if that is any help
-
Are you running out of RAM during the download?
-
The computer I am on has 2gb of ram and the usb drive that I am running from has about 3gb off empty space so unless it takes a LOT of space while downloading I should not be.
-
try to download by hand ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.6/enu/AdbeRdr9.4.6-1_i486linux_enu.tar.bz2 place in /opt/acroread123 directory and try to relaunch the script
-
I get the same message at 59% then also so I have a space issue I'm just not sure how because I have 3gb free on my thumb drive. In the mean time is there a way I could modify the script to look elseware for the file because I can download the file.
-
Ok I was able to modify the script and got a message that the tcz was in the app directory and was ready for install but upon restart nothing, it is not recognized.
-
Hi Techmaster317
I believe that script creates the package but does not install it. Try opening AppBrowser, click on
local, select the acrobat package, click on Go.
-
I think that is going in the right direction. I tried installing with appbrowser and it says it installed however nothing new appears in applications and no matter what type of shutdown I select it shuts down immediately and upon restart the app shows as not installed. I have tried shutdown without installing the program and all is in order so I know the program has something to do with it. Any ideas?
-
Use AppsAudit to select the application for either onboot or ondemand.
-
Unfortunately it is not showing up in appsaudit, it only shows in appbrowser.
-
When an extension does not show up it is usually because it has already been assigned to on boot, or one of the other choices.
Apps audit can appear confusing when we are new to using it, good luck
-
It is not showing up in appsaudit anywhere, I looked through all the tabs and options and it is not there. The only thing that I have found that says it is installed is trying to install it again with appbrowser shows message already installed and as I have mentioned it will only do a quick shutdown and not be there once I restart.
-
anybody have anymore ideas?
-
Check the wiki articles on persistence. It sounds like you have no persistent storage.
-
The SRCDIR is /opt/acroread123, not /opt. If you place the tarball in /opt it will be downloaded again, and again. Since the download attempts were cut short with control-C, the source will start downloading again since the source is deleted if it's md5sum does not match up.
It works here, I cannot reproduce.
I am using coreplus 9.0 and this script is asking me to install openssl-1.0.0.tcz, but it does not exit.
tce-load returns 404 for openssl-1.0.0.tcz
-
Hi winer
Remove the version numbers from those 3 lines in the script so they say openssl instead of openssl-1.0.0.
-
BTW. A modern browser like Firefox will open PDF files. There are other dedicated pdf readers aswell
Sent from my iPhone using Tapatalk