(Solved) Help with hybrid Slackbuild script.

General talk about packaging procedures and packages.
User avatar
globetrotterdk
Posts: 435
Joined: 26. Oct 2010, 13:57
Location: Denmark

(Solved) Help with hybrid Slackbuild script.

Post by globetrotterdk »

I am hoping that some one on the forum is interested in giving me a hand with the following Slackbuild. I am trying to go for the salient points (seen from my perspective) in both the existing Slackbuild script for VueScan, as well as a Slacky build script. The first issue was of course updating to the latest file name. Secondly, I want to install the program in /usr/bin. Thirdly, install a vuescan.png file, and lastly ensure that a menu item appears in Salix64 14.1 MATE application menu. (The scrip items are listed above as per priority and not according to position in the script.)

Did I combine the scripts successfully? If not, what do I need to change?

Code: Select all

#!/bin/sh

# Heavily based on the Slackware 14.1 SlackBuild as well as an Slacky Slackbuild.
# Packager GlobetrotterDK

PRGNAM=vuescan
VERSION=${VERSION:-9.4.47}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

# and choose source file accordingly
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86)
	ARCH=i486
	SOURCEFILE=vuex3295.tgz ;;
    x86_64)
	ARCH=x86_64
	SOURCEFILE=vuex6495.tgz ;;
    # Other archs are unsupported:
       *) echo "ARCH $( uname -m ) is unsupported."; exit 1 ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e 

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
tar xvf $CWD/$SOURCEFILE
chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# Program does not need compiling, is a binary program

# Program does not provide any means of installing. Installing manually to /opt is one possibility
#mkdir -p $PKG/opt/$PRGNAM
#cp -a VueScan/* $PKG/opt/$PRGNAM

#However, I choose to install to usr/bin
mkdir -p $PKG/usr/bin
cat <<EOF >$PKG/usr/bin/vuescan
#!/bin/sh
exec /usr/lib/VueScan/vuescan
EOF
chmod +x $PKG/usr/bin/vuescan
chmod +x $PKG/usr/lib/VueScan/vuescan

mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/vuescan.png > $PKG/usr/share/pixmaps/vuescan.png

# Create a file that will appear in DE/WM menu
cat << EOF > $PKG/usr/share/applications/vuescan.desktop
[Desktop Entry]
Name=VueScan
GenericName=Scanner program
GenericName[it]=Applicazione per Scanner
Comment=Powerful, easy to use scanner utility
Comment[it]=Applicazione per scanner potente e facile da usare
Exec=vuescan
Icon=vuescan
StartupNotify=true
Terminal=0
Type=Application
Encoding=UTF-8
Categories=Application;Graphics;
EOF

# Include the SlackBuild script in the documentation directory
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# Copy the slack-desc into ./install
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

# Make the package; be sure to leave it in $OUTPUT
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
Last edited by globetrotterdk on 6. Mar 2016, 15:45, edited 1 time in total.
Military justice is to justice what military music is to music. - Groucho Marx
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Help with hybrid Slackbuild script.

Post by mimosa »

Have you tried running it? If it fails, please post the output.
User avatar
globetrotterdk
Posts: 435
Joined: 26. Oct 2010, 13:57
Location: Denmark

Re: Help with hybrid Slackbuild script.

Post by globetrotterdk »

mimosa wrote:Have you tried running it? If it fails, please post the output.
Thanks for the quick reply mimosa. Here is the output:

Code: Select all

$ ./vuescan.SlackBuild
bash: ./vuescan.SlackBuild: Permission denied
$ sudo ./vuescan.SlackBuild
sudo: ./vuescan.SlackBuild: command not found
Unfortunately I didn't get very far. I assume this has something to do with "sudo"?
Military justice is to justice what military music is to music. - Groucho Marx
User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: Help with hybrid Slackbuild script.

Post by laprjns »

Code: Select all

$ chmod +x vuescan.Slackbuild 
$ sudo ./vuescan.Slackbuild 
I am curious as to why you are doing this.
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Help with hybrid Slackbuild script.

Post by mimosa »

Without having looked at all closely at this, I suspect moving the main executable to /usr/bin won't work, otherwise the sources you're drawing on would have done it already. For whatever reason, all the files must need to be together somewhere else.

You could probably make a symlink from /usr/bin/whatever to the appropriate file in /opt (or other location of your choice); or else add the location to your $PATH.
User avatar
globetrotterdk
Posts: 435
Joined: 26. Oct 2010, 13:57
Location: Denmark

Re: Help with hybrid Slackbuild script.

Post by globetrotterdk »

laprjns wrote:

Code: Select all

$ chmod +x vuescan.Slackbuild 
$ sudo ./vuescan.Slackbuild 
I am curious as to why you are doing this.
Thanks. I just picked up on this myself. The original Slackbuild puts the executable in /opt and then writes a script that goes into /usr/bin. In reality (believe it or not) I am just trying to make things simpler and make sure that the executable will show up in the MATE application menu -> Graphics.
Last edited by globetrotterdk on 6. Mar 2016, 14:14, edited 1 time in total.
Military justice is to justice what military music is to music. - Groucho Marx
User avatar
globetrotterdk
Posts: 435
Joined: 26. Oct 2010, 13:57
Location: Denmark

Re: Help with hybrid Slackbuild script.

Post by globetrotterdk »

mimosa wrote:Without having looked at all closely at this, I suspect moving the main executable to /usr/bin won't work, otherwise the sources you're drawing on would have done it already. For whatever reason, all the files must need to be together somewhere else.

You could probably make a symlink from /usr/bin/whatever to the appropriate file in /opt (or other location of your choice); or else add the location to your $PATH.
After sorting out the cmod, this is what I got:

Code: Select all

]$ chmod +x vuescan.SlackBuild
$ sudo ./vuescan.SlackBuild
VueScan/
VueScan/vuescan.ds
VueScan/vuescan.svg
VueScan/vuescan
VueScan/vuescan.8ba
chmod: cannot access ‘/tmp/SBo/package-vuescan/usr/lib/VueScan/vuescan’: No such file or directory
The Slacky version of the script does it like this, which seems simpler to me:

Code: Select all

# Install the executable file.
mkdir -p $PKG/usr/bin
cat <<EOF >$PKG/usr/bin/vuescan
#!/bin/sh
exec /usr/lib/VueScan/vuescan
EOF
chmod +x $PKG/usr/bin/vuescan
chmod +x $PKG/usr/lib/VueScan/vuescan


mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/vuescan.png > $PKG/usr/share/pixmaps/vuescan.png

cat << EOF > $PKG/usr/share/applications/vuescan.desktop
[Desktop Entry]
Name=VueScan
GenericName=Scanner program
GenericName[it]=Applicazione per Scanner
Comment=Powerful, easy to use scanner utility
Comment[it]=Applicazione per scanner potente e facile da usare
Exec=vuescan
Icon=vuescan
StartupNotify=true
Terminal=0
Type=Application
Encoding=UTF-8
Categories=Application;Graphics;
EOF

mkdir -p $PKG/usr/doc/$NAME-$VERSION/SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/SlackBuild/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/SlackBuild/$NAME.SlackBuild

	echo "if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database &> /dev/null
fi" >> $PKG/install/doinst.sh
	echo "" >> $PKG/install/doinst.sh
	echo "if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache  -f -q /usr/share/icons/hicolor &> /dev/null
fi" >> $PKG/install/doinst.sh
	echo "" >> $PKG/install/doinst.sh
The executable can be run from the desktop, so there is no specific place that it resides. I am just trying to get things stowed away in their proper places the Slackware way, and make sure that the executable shows up under the proper menu sub-heading.
Military justice is to justice what military music is to music. - Groucho Marx
User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: Help with hybrid Slackbuild script.

Post by laprjns »

I agreed that there should be a desktop file so that you can launch from a menu, but the SBo slackbuild doesn't created it. However i don't think you need to move the binaries to /usr/bin.
globetrotterdk wrote:The original Slackbuild puts the executable in /opt and then writes a script that goes into /usr/bin.
Just let it installed the script and your desktop file that you are creating will work with it.
globetrotterdk wrote: In reality (believe it or not) I am just trying to make things simpler and make sure that the executable will show up in the MATE application menu -> Graphics.
Actually the easiest thing to do is to create the desktop file, save it to /usr/shar/applications and install vuescan using the Slackbuild unchanged. Then in the future you can easily update vuescan using spi or slapt-src ( although it does have an issue with changing checksums so you still may need to run the Slackbuild manually)

Image
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
User avatar
globetrotterdk
Posts: 435
Joined: 26. Oct 2010, 13:57
Location: Denmark

Re: Help with hybrid Slackbuild script.

Post by globetrotterdk »

OK. I created the vuescan.desktop file manually and copied the included the .svg image file to the correct place. I then downloaded the SBo Slackbuild script and only modified the file name to fit the downloaded file. I ran the script and installed the package. Everything seems to work fine, so I am happy despite not having learned anything more about the formulation and workings of Slackbuild scripts.
Military justice is to justice what military music is to music. - Groucho Marx
User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: (Solved) Help with hybrid Slackbuild script.

Post by laprjns »

You do know that unless you pay and register vuescan, it puts watermarks on all your scanned documents.
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
Post Reply