Slackware 二进制包制作

出自WPS For Linux

跳转到: 导航, 搜索

目录


按照本说明可以在任何发行版上制作Slackware安装包

包构建

Slackware的安装包是从官方发布的deb包构建 在Slackware64下运行32位软件请参考http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:multilib

需要文件:
wps-office.SlackBuil 主脚本
wps-office的deb包
makepkg 一个脚本,最后打包成slackware安装包,由wps-office.SlackBuild调用

将以上文件放置在同一目录下(应只有一个deb包),终端运行./wps-office.SlackBuild即可打包。

可选项说明:
可以运行 VAR=value ./wps-office.SlackBuild 自定一些选项。

可选的VAR和其值value的说明如下:

VAR value
TMP 临时文件存放目录,默认是/tmp
OUTPUT slackware包的输出目录,默认是当前目录
BUILD 第几次打包,默认是1
TAG 标识,Slackware包一般会有标识打包人或组织,这里默认是aten
TOOLDIR makepkg脚本所在目录,默认是当前目录
PKGTYPE Slackware包后缀,默认是.txz,可选为.tgz

wps-office.SlackBuild内容

#!/bin/sh

# Slackware build script for wps-office
# Aten Zhang revision date 2012/04/24

# This script builds Slackware package of wps-office from Ubuntu .deb package.
if ! /bin/ls wps-office*.deb > /dev/null 2>&1 ; then
  cat << EOF

This is a script to repackage a Ubuntu wps-office .deb package
for Slackware. The binary package like below should be in the 
same directory as this script:

  wps-office_8.1.0.3151+wps+wpp~a3_i386.deb
  
This will create a Slackware .tgz(or .txz) package. Install it
with installpkg or use upgradepkg to upgrade from a previous 
version.

EOF
  exit 1
fi

CWD=$(pwd)			# current work directory
TMP=${TMP:-/tmp}		# temp directory
PKG=$TMP/package-$PKGNAM	
OUTPUT=${OUTPUT:-"$(pwd)"}	# the output package will put here
TOOLDIR=${TOOLDIR:-"$(pwd)"}

PKGNAM=wps-office
BUILD=${BUILD:-1}	# The nth time you build the package.(default first)
VERSION=$(ar p ${CWD}/${PKGNAM}*.deb control.tar.gz 2> /dev/null | tar zxO ./control 2> /dev/null | grep Version | awk '{print $2}')
TAG=${TAG:-_aten}
ARCH=$(ar p ${CWD}/${PKGNAM}*.deb control.tar.gz 2> /dev/null | tar zxO ./control 2> /dev/null | grep Architecture | awk '{print $2}')

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $PKG
ar p $CWD/${PKGNAM}*.deb data.tar.gz | gzip -d | tar xv || exit 1

if [  $UID = 0 ]; then
	chown -R root:root .
fi

# fonts in Slackware locate in /usr/share/fonts/TTF
mkdir -p $PKG/usr/share/fonts/TTF
mv $PKG/usr/share/fonts/wps-office $PKG/usr/share/fonts/TTF

mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a  $CWD/README $PKG/usr/doc/$PKGNAM-$VERSION
cat $CWD/$PKGNAM.SlackBuild > $PKG/usr/doc/$PKGNAM-$VERSION/$PKGNAM.SlackBuild

mkdir -p $PKG/install 
# Add a package description:
declare -i length=$(echo $PKGNAM | wc -m)-1
blank=' '
for num in $(seq 2 $length)
do
  blank=${blank}' '
done
cat > $PKG/install/slack-desc <<EOF
# 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 ':'.

$blank|-----handy-ruler-----------------------------------------------------|
$PKGNAM: WPS Office (an office productivity suite for Linux)
$PKGNAM:
$PKGNAM: WPS Office, including Writer, Presentation and spreadsheets, is a 
$PKGNAM: powerful office suite. It is deeply compatible with all of the
$PKGNAM: latest Microsoft Office file formats. It can easily open and read
$PKGNAM: the documents created with Microsoft Office.
$PKGNAM: 
$PKGNAM: This is the Linux version, and it's now an ALPHA package.
$PKGNAM:
$PKGNAM: Homepage: http://linux.wps.cn
$PKGNAM:
EOF

# add doinst.sh script
ar p ${CWD}/${PKGNAM}*.deb control.tar.gz 2> /dev/null | tar zxO ./postinst 2> /dev/null > $PKG/install/doinst.sh
sed -i 's/\/usr\/share\/fonts/\/usr\/share\/fonts\/TTF/g' $PKG/install/doinst.sh

cd $PKG
$TOOLDIR/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}

rm -rf $PKG

makepkg脚本

可在下载。

个人工具