LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Need a Little Help with deb2tgz (https://www.linuxquestions.org/questions/slackware-14/need-a-little-help-with-deb2tgz-4175589838/)

enorbet 09-20-2016 09:39 PM

Need a Little Help with deb2tgz
 
Attention: If you accessed this thread looking for solutions to deb2tgz this is probably not the place. At least for me it is really rare that I ever come across an app that is only available as a .deb, and even then simply extracting the files and manually placing them where designated has always worked. In this case the app was also only available as 64 bit and my system was 32 bit. If you'd like to follow the process to installing and configuring 64 bit multilib feel free to read on. As for deb2tgz, I'll leave that to others as I so rarely need it.


Greetz
I have an app, Discord, that I need to install and the first problem I face is with just getting the source out and a tgz package would be a good start. I can't find a DlackBuild and tho the devs expect a full native Linux build at some point all they have now is Discord-Canary-0.8.deb.

At first deb3tgz errored out because upon extracting the deb I discovered that control is in the form control.tar.gz but data is in the form data.tar.xz. Since deb2tgz is a script I tried altering the search name from gz to xz and it no longer errors out byt I get no output after it completes.

I've never used deb2tgz before and I must be suffering a brain cramp 'cuz I don't know what to do next after trying just placing the files in their respective locations manually. The only error message I get is

Code:

bash: /usr/bin/discord-canary: cannot execute binary file
any help? FWIW this is on my 14.0 32 bit install. The only thing I can think of, since the devs simply linked the deb and it isn't specified whether or not it is 32 or 64bit, is to try it on my 14.2 64 bit install on another machine. I need it on this machine as 32 bit before anyone suggests using that install.

frankbell 09-20-2016 10:02 PM

I have not used deb2tgz, but I have used rpm2tgz. It's pretty straightforward. Change directory into the directory where the *.rpm is stored, then, as root, execute

Code:

rpm2tgz [filename]
Have you tried that, replacing "rpm2tgz" with "deb2tgz??

Gordie 09-20-2016 11:33 PM

I get that a lot with deb files

bash-4.3# deb2tgz discord-canary-0.0.8.deb
mv: cannot stat 'data.tar.gz': No such file or directory
ERROR: ar failed. (maybe discord-canary-0.0.8.deb is not an DEB?)
bash-4.3#

bassmadrigal 09-21-2016 12:30 AM

You can use ar to extract .debs with a few extra pipes.

For xz compressed debs:

Code:

ar p Discord-Canary-0.8.deb data.tar.xz | unxz | tar -xv
For gz compressed debs:

Code:

ar p Discord-Canary-0.8.deb data.tar.gz | gzip -d | tar -xv
Both of these can be used in a SlackBuild and doesn't require any additional packages (since deb2tgz isn't included in Slackware). You can see an example with my filebot.SlackBuild (hasn't been submitted to SBo yet).

I've found this is the easiest native way to extract deb packages for SlackBuilds.

enorbet 09-21-2016 12:15 PM

Quote:

Originally Posted by frankbell (Post 5608036)
I have not used deb2tgz, but I have used rpm2tgz. It's pretty straightforward. Change directory into the directory where the *.rpm is stored, then, as root, execute

Code:

rpm2tgz [filename]
Have you tried that, replacing "rpm2tgz" with "deb2tgz??

Actually I used

Code:

deb2tgz ./Discord-Canary-0.81.deb
and specified the work be targeting that specific file in that specific directory. That is what finally "completed" but with no output.

enorbet 09-21-2016 12:18 PM

Quote:

Originally Posted by Gordie (Post 5608056)
I get that a lot with deb files

bash-4.3# deb2tgz discord-canary-0.0.8.deb
mv: cannot stat 'data.tar.gz': No such file or directory
ERROR: ar failed. (maybe discord-canary-0.0.8.deb is not an DEB?)
bash-4.3#

As I mentioned briefly I overcame that by altering the deb2tgz script to reflect the format I found within the deb. I changed the line designating "data.tar.gz" to "data.tar.xz" temporarily or as needed and got past that error... just not to any meaningful result.

enorbet 09-21-2016 12:23 PM

Thank you, bassmadrigal, as I stated I was able to extract the deb file and I copied all of the files (including hidden files) to their designated location - /usr/bin and /usr/share, scattered in a few subdirectories as listed.

I found your SB example enlightening but so far it still fails for me in this case. I'm suspecting either a dependency issue or an architecture mismatch and am writing the devs today about $ARCH and any dependencies.

Guttorm 09-21-2016 12:41 PM

Hi

I was thinking of trying a Debian command called alien that can convert to/from deb and tgz. But searching for the deb I found this:

https://www.reddit.com/r/discordapp/...anary_release/

There's a link to a tar.gz download.

bassmadrigal 09-21-2016 02:53 PM

Yeah, my SlackBuild is based on having an ARCH declared in the package title (which is common for Ubuntu packages ($PRGNAM-$VERSION-$DEBARCH -- Discord-Canary-0.8-i386.deb), but it can be adjusted to not use it.

When you manually copied the files/folders over, did the program work, or is that what you meant when you said it fails for you?

I can try to look at it tonight and see what I can find. Also, as Guttorm found, it seems they might have a tar.gz release so you wouldn't have to deal with unpacking the .deb, but I'll try to remember to check that out at home as well.

bassmadrigal 09-21-2016 04:05 PM

Ok, after getting home and looking at everything, a few minor tweaks to the filebot SlackBuild (seems they have a few libraries hardcoded to the "current directory", so I had to remove the symlink and use a script to launch it) had this packaging and then opening. But I don't have an account, so I can't test how well it actually works. Feel free to give it a shot. Also, the binaries seem to be 64bit only, so I caused the script to fail if it is run on a 32bit system.

Code:

#!/bin/sh

# Slackware build script for discord-canary
#
# Copyright 2016  Jeremy Hansen <jebrhansen+SBo -at- gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PRGNAM=discord-canary
VERSION=${VERSION:-0.0.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_bass}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
      *) ARCH=$( uname -m ) ;;
  esac
fi

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

if [ "$ARCH" = "i586" ]; then
  DEBARCH="i386"
  LIBDIRSUFFIX=""
  echo "This package is currently only available for 64bit."
  exit 1
elif [ "$ARCH" = "x86_64" ]; then
  DEBARCH="amd64"
  LIBDIRSUFFIX="64"
else
  echo "Package for $(uname -m) architecture is not available."
  exit 1
fi

set -eu

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $PKG
ar p $CWD/${PRGNAM}-${VERSION}.deb data.tar.xz | unxz | tar xv

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 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# Create launcher with $PATH updated

rm $PKG/usr/bin/discord-canary
cat << EOF > $PKG/usr/bin/discord-canary
#!/bin/bash

/usr/share/discord-canary/DiscordCanary
EOF
chmod 0755 $PKG/usr/bin/discord-canary

# Create slack-desc
mkdir -p $PKG/install/
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':' except on otherwise blank lines.

              |-----handy-ruler------------------------------------------------------|
discord-canary: discord-canary (It's time to ditch Skype and TeamSpeak)
discord-canary:
discord-canary: All-in-one voice and text chat for gamers that's free, secure, and
discord-canary: works on both your desktop and phone. Stop paying for TeamSpeak
discord-canary: servers and hassling with Skype. Simplify your life.
discord-canary:
discord-canary: Homepage: https://discordapp.com/
discord-canary:
discord-canary:
discord-canary:
discord-canary:
EOF

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

As for the tar.gz, it looks to just be the /usr/share/discord-canary folder, so you'd have to create the folder structure if you want to use it as a package (or just use it in a directory in your ~ or throw it into /opt/).

enorbet 09-21-2016 08:56 PM

Major Thank Yous for bassmadrigal and Guttorm! Glad to know my failure was likely due to ARCH mismatch. I'm far more comfortable with source and will do it "old skool" by just viewing config and just compiling. Once I get that working I will do the SlackBuild so the app get's listed and is properly uninstallable. It may seem redundant but I'm comfortable with small steps. I'll report back soon.

bassmadrigal 09-22-2016 07:45 AM

Quote:

Originally Posted by enorbet (Post 5608500)
Major Thank Yous for bassmadrigal and Guttorm! Glad to know my failure was likely due to ARCH mismatch. I'm far more comfortable with source and will do it "old skool" by just viewing config and just compiling. Once I get that working I will do the SlackBuild so the app get's listed and is properly uninstallable. It may seem redundant but I'm comfortable with small steps. I'll report back soon.

I didn't see any source, so I don't think this is opensource and something you can compile. The tar.gz file that Guttorm mentioned is a pre-compiled package that is meant to be run from the extracted directory. This would be used if you didn't want to install it on a system, but just wanted to unpack it in your home directory. You can also use that to create a package, but I feel it would be a bit more work than just using the folder structure provided by the .deb package, but the choice is obviously upon whoever decides to create the package.

enorbet 09-22-2016 09:31 AM

Yes I discovered that snafu right away. My problem is compounded by what seems to be no available 32 bit versions at all. I even tried the Windows version in wine. I am likely stuck with the web browser version. At least there's that. FWIW, though some may find it backward, my most important apps are 32 bit and at the very least my main PC would be a poor investment to "upgrade" to 64 bit with no net gain I can see, and quite probably a net loss due to additional layers of complexity. This is, however, likely the beginning of the final shift for 64 bit dominance where compliance is just easier.

bassmadrigal 09-22-2016 10:11 AM

What programs do you use that are 32bit only? For what it's worth, I've noticed no issues running multilib on my desktop (I did it for steam -- checking my system, the only 32bit packages I have installed are steam and googleearth, but I don't even remember the last time I opened Google Earth). There might be some measureable time differences in running 32bit apps on a multilib system, but, while they may be measurable, I doubt they're very noticeable. My htpc now has no reliance on 32bit software, so I'm running a pure 64bit Slackware on there. I'm not saying any of this to pursuade you to switch, just providing my experiences :)

For future reference, you can check if a program is 32bit or 64bit using file.

Code:

file /location/to/DiscordCanary

enorbet 09-22-2016 09:33 PM

Thanks again bassmadrigal. I have used dedicated 32 bit so long I had forgotten that "file' will reveal architecture.

FTR I use an old version of KDE's Kpackage regularly and had to install v3 support in /opt to continue to run it. I love that app and it is a rare week that I don't consult it several times. I don't know if that would be a problem in 64 bit. I also have an ancient but still simple and useful app for drawing schematics and don't relish learning a new one with more "features" than I need. Additionally I do multimedia work, more audio than video, and not having to reboot, but just running them when needed in wine (alongside my favorite Native Linux Ardour) , as well as a few games that run with less overhead and more local control than with Steam is handy and likeable. From what I read, wine is much easier to work with, at least for the time being, in a 32 bit OpSys. I depend mostly on external firewalls for security and never install, let alone run, IE or Outlook, etc,. so I am unconcerned with any substantial issues with wine. It beats having to reboot and run actual Windows, hands down, IMHO.

I recognize that within a few years I will actually need to go 64 bit and that's acceptable but until then I'm quite content with the simplicity of 32 bit and I have a huge amount of work invested in it.


All times are GMT -5. The time now is 04:10 PM.