-
Notifications
You must be signed in to change notification settings - Fork 3
/
fix-linux-bz2-package
executable file
·54 lines (44 loc) · 1.25 KB
/
fix-linux-bz2-package
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
. ./BUILDDEFS
set -ex
PKGPATH=$1
ARCHNAME=$(basename ${PKGPATH%})
PKGNAME=${ARCHNAME%.*.*}
[[ "${PKGNAME}" == *"demo"* ]] && DEMO="-demo" || DEMO=""
cd $(dirname "${PKGPATH}")
echo "Flattening package ${PKGNAME}..."
# Extract
tar -xjvf ${ARCHNAME}
if [ ! -d "${PKGNAME}/usr" ] ; then
echo "This package has already been flattened!"
rm -rf ${PKGNAME}
exit
fi
rm -f ${ARCHNAME}
ORIGPKG="${PKGNAME}.orig"
mv ${PKGNAME} ${ORIGPKG}
# Rebuild
mkdir ${PKGNAME}
mv ${ORIGPKG}/usr/bin/kobord${DEMO} ${PKGNAME}
mv ${ORIGPKG}/usr/share/koboredux${DEMO}/* ${PKGNAME}
mv ${ORIGPKG}/usr/share/doc/koboredux${DEMO}/* ${PKGNAME}
mv ${PKGNAME}/copyright ${PKGNAME}/EULA.txt
ITCHMANIFEST="itch.toml"
if [[ ! "${DEMO}" == "" ]] ; then
ITCHMANIFEST="demo.${ITCHMANIFEST}"
fi
if [ "${KOBO_STATIC_LINUX}" = true ] ; then
ITCHMANIFEST="static.${ITCHMANIFEST}"
else
mkdir ${PKGNAME}/lib
cp ${WORKDIR}/linux-bundle-lib/* ${PKGNAME}/lib
cp ${SOURCEDIR}/linux-bundle/kobord${DEMO}.sh ${PKGNAME}
cp ${SOURCEDIR}/linux-bundle/koboredux${DEMO}.desktop ${PKGNAME}
fi
cp ${SOURCEDIR}/linux-bundle/${ITCHMANIFEST} ${PKGNAME}/.itch.toml
# Archive
BZIP2=--best tar -cvjSf ${ARCHNAME} ${PKGNAME}
# Clean up
rm -rf ${PKGNAME}
rm -rf ${ORIGPKG}
echo "Package ${PKGNAME} flattened!"