Compare commits
86 Commits
Author | SHA1 | Date | |
---|---|---|---|
9acdb7b8c7 | |||
d56b70e0da | |||
9c866b1fa5 | |||
181ded1e77 | |||
566b36f503 | |||
244b9fc018 | |||
6011e4eca8 | |||
a6eef880ad | |||
f486eeeffe | |||
e6e62b4563 | |||
1687fc40af | |||
cd1ccc1904 | |||
4bb631a27f | |||
529b8fb8bf | |||
8d609d6825 | |||
81d51fe6d9 | |||
468e25514c | |||
7fc25f56aa | |||
6e40b1b433 | |||
f95d411393 | |||
b6a06ef878 | |||
1a312489cc | |||
0119b0837c | |||
8f66ba5955 | |||
656281432e | |||
5e0104a617 | |||
27324dd2a9 | |||
e9e193ff8c | |||
03b159b3b6 | |||
caa0af8b0a | |||
979743df69 | |||
71f19ede36 | |||
317f6ab193
|
|||
6db7ab71ef
|
|||
c2935124ac
|
|||
108eebe53e
|
|||
bdd6f48c5f
|
|||
055c1e54bd
|
|||
bd5f3a30ec
|
|||
8f4000a1be
|
|||
dc1c78f19a
|
|||
179c2bc6a9
|
|||
1ae689cb57
|
|||
738378c142
|
|||
1d929222fc
|
|||
0c1292e4e0
|
|||
a19e125e84
|
|||
2a4b497097
|
|||
0bbb947d99
|
|||
4a59a8c767
|
|||
d575fe0558
|
|||
1b62dc5394
|
|||
cbf5703ff3
|
|||
ef884077c0
|
|||
e7b301e684
|
|||
091135939d
|
|||
bad3ee3b8a
|
|||
768f4b5d0b
|
|||
563c475788
|
|||
6956a4ed02 | |||
ab0aca7977 | |||
95f0aedb55 | |||
99934710d6 | |||
98a72a22f0 | |||
a5604126c7 | |||
c65770e0dd | |||
19541a4d3c | |||
3a48a1818f | |||
040e934b79 | |||
88b3dbe8ca | |||
f5c989a1c4 | |||
0b1b300530 | |||
554cb5737e | |||
ec9bfca4f2 | |||
fff2f73026 | |||
1d1dee830a | |||
33bc2528b4 | |||
87f92a500c | |||
328d005a58 | |||
8911982416 | |||
fa596a6f77 | |||
6ef4f7b561 | |||
e04a54084f | |||
3378b83ad8 | |||
c67fb3e92c | |||
7abeeb5607 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: ich777
|
74
Dockerfile
74
Dockerfile
@@ -2,35 +2,79 @@ FROM ich777/debian-baseimage
|
||||
|
||||
LABEL maintainer="admin@minenet.at"
|
||||
|
||||
RUN echo "deb http://deb.debian.org/debian bullseye main" >> /etc/apt/sources.list && \
|
||||
RUN echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list && \
|
||||
apt-get update && \
|
||||
apt-get -y install nano make gcc-9 bison flex bc libelf-dev squashfs-tools patch build-essential kmod cpio libncurses5-dev unzip rsync git curl bmake lsb-release libseccomp-dev libcap-dev pkg-config patchutils uuid-dev libblkid-dev libssl-dev dh-autoreconf libproc-processtable-perl beep zip libibmad-dev python3-dev python3-setuptools gperf openssh-server ninja-build meson glib2.0 libudev-dev cmake udev libpolkit-gobject-1-dev libumockdev-dev docbook-xml libneon27-gnutls-dev jq python3-simplejson && \
|
||||
apt-get -y install --no-install-recommends curl screen qtchooser libqt5core5a && \
|
||||
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
||||
apt-get -y install nodejs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install nano make gcc-12 bison flex bc libelf-dev squashfs-tools patch build-essential kmod cpio libncurses5-dev python3 python3-pip unzip rsync git curl bmake lsb-release libseccomp-dev libcap-dev pkg-config patchutils uuid-dev libblkid-dev libssl-dev dh-autoreconf libproc-processtable-perl beep zip libibmad-dev python3-dev python3-setuptools gperf openssh-server ninja-build libglib2.0-0 libudev-dev cmake udev libpolkit-gobject-1-dev libumockdev-dev docbook-xml libneon27-gnutls-dev jq python3-simplejson libfuse-dev iputils-ping tidy check libbsd-dev libpam0g-dev docbook2x libaio-dev python3-mesonpy xz-utils libdbus-1-dev && \
|
||||
cd /tmp && \
|
||||
wget -q -nc --show-progress --progress=bar:force:noscroll -O go.tar.gz https://golang.org/dl/go1.15.linux-amd64.tar.gz && \
|
||||
wget -q -nc --show-progress --progress=bar:force:noscroll -O go.tar.gz https://go.dev/dl/go1.22.2.linux-amd64.tar.gz && \
|
||||
tar -C /usr/local -xvzf go.tar.gz && \
|
||||
export PATH=$PATH:/usr/local/go/bin && \
|
||||
rm -R /tmp/go* && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev libgdbm-dev liblzma-dev tk8.6-dev lzma lzma-dev libgdbm-dev python3-pip libcairo2-dev python3-dev libgirepository1.0-dev python3-cairo-dev libgdbm-compat-dev python3-wheel && \
|
||||
rm /var/lib/sgml-base/supercatalog && \
|
||||
apt-get -y install zlib1g-dev libbz2-dev liblzma-dev libreadline6-dev libsqlite3-dev libssl-dev libgdbm-dev liblzma-dev tk8.6-dev lzma lzma-dev libgdbm-dev libcairo2-dev python3-dev libgirepository1.0-dev python3-cairo-dev libgdbm-compat-dev python3-wheel && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#RUN rm -R /lib/x86_64-linux-gnu/liblzma.* && \
|
||||
# cd /tmp && \
|
||||
# wget -q -nc --show-progress --progress=bar:force:noscroll -O /tmp/xz.tar https://github.com/ich777/runtimes/raw/master/xz/xz.tar && \
|
||||
# tar -C / -xvf /tmp/xz.tar && \
|
||||
# rm -R /tmp/xz.tar
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends curl screen && \
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
|
||||
apt-get -y install --no-install-recommends nodejs && \
|
||||
apt-get -y install libgtk2.0-dev liblablgtk2-ocaml liblablgtk-extras-ocaml-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN rm -R /lib/x86_64-linux-gnu/liblzma.* && \
|
||||
cd /tmp && \
|
||||
wget -q -nc --show-progress --progress=bar:force:noscroll -O xz.tar https://github.com/ich777/docker-unraid-kernel-helper/raw/6.9.0/xz.tar && \
|
||||
tar -C / -xvf /tmp/xz.tar
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install libssl-dev xorg-dev libvncserver-dev sshpass && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install libkmod-dev libproc2-0 libdw-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install libxcb-dri2-0-dev libva-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install qt5-qmake qtscript5-dev libqt5svg5-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install libasound-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install yasm libx264-dev libx265-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install nasm iasl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install libpci-dev libnl-3-dev libnl-genl-3-dev gettext libgettextpo-dev autopoint gettext libncursesw5-dev libtool-bin autoconf-archive && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#RUN apt-get update && \
|
||||
# apt-get -y install net-tools libjson-glib-dev expect gawk socat gnutls-bin python nasm iasl && \
|
||||
# mkdir -p /tmp/pkgs && cd /tmp/pkgs && \
|
||||
# wget http://ftp.debian.org/debian/pool/main/libt/libtpms/libtpms-dev_0.9.2-3_amd64.deb && \
|
||||
# wget http://ftp.debian.org/debian/pool/main/libt/libtpms/libtpms0_0.9.2-3_amd64.deb && \
|
||||
# dpkg -i libtpms0_0.9.2-3_amd64.deb && \
|
||||
# dpkg -i libtpms-dev_0.9.2-3_amd64.deb && \
|
||||
# rm -rf /tmp/pkgs && \
|
||||
# rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /run/sshd && \
|
||||
rm -v /etc/ssh/ssh_host_* && \
|
||||
sed -i "/#Port 22/c\Port 8022" /etc/ssh/sshd_config && \
|
||||
@@ -40,10 +84,11 @@ RUN mkdir -p /run/sshd && \
|
||||
sed -i "/#HostKey \/etc\/ssh\/ssh_host_ed25519_key/c\HostKey \/root\/.ssh\/ssh_host_ed25519_key" /etc/ssh/sshd_config && \
|
||||
sed -i "/#PermitRootLogin prohibit-password/c\PermitRootLogin yes" /etc/ssh/sshd_config
|
||||
|
||||
COPY makepkg /sbin/makepkg
|
||||
|
||||
ENV DATA_DIR="/home/debian"
|
||||
ENV ROOT_PWD="password"
|
||||
ENV PATH="$PATH:/usr/local/go/bin"
|
||||
ENV GOPATH=/usr/src/go/
|
||||
ENV UID=99
|
||||
ENV GID=100
|
||||
ENV UMASK=0000
|
||||
@@ -56,7 +101,8 @@ RUN mkdir -p $DATA_DIR && \
|
||||
ulimit -n 2048
|
||||
|
||||
ADD /scripts/ /opt/scripts/
|
||||
RUN chmod -R 770 /opt/scripts/
|
||||
RUN chmod -R 770 /opt/scripts/ && \
|
||||
chmod +x /sbin/makepkg
|
||||
|
||||
#Server Start
|
||||
ENTRYPOINT ["/opt/scripts/start.sh"]
|
@@ -1,2 +1,3 @@
|
||||
# docker-debian-builder
|
||||
# Debian build container
|
||||
|
||||
This is a basic Debian container configured to my needs to compile stuff.
|
459
makepkg
Normal file
459
makepkg
Normal file
@@ -0,0 +1,459 @@
|
||||
#!/bin/bash
|
||||
# Copyright 1994, 1998, 2008 Patrick Volkerding, Moorhead, Minnesota USA
|
||||
# Copyright 2003 Slackware Linux, Inc. Concord, CA USA
|
||||
# Copyright 2009, 2015, 2017, 2018, 2019 Patrick J. Volkerding, Sebeka, MN, USA
|
||||
# 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.
|
||||
#
|
||||
# Mon 2 Jul 15:32:14 UTC 2018
|
||||
# Sort file lists and support SOURCE_DATE_EPOCH, for reproducibility.
|
||||
#
|
||||
# Mon May 21 18:31:20 UTC 2018
|
||||
# Add --compress option, usually used to change the preset compression level
|
||||
# or block size.
|
||||
#
|
||||
# Tue Feb 13 00:46:12 UTC 2018
|
||||
# Use recent tar, and support storing POSIX ACLs and extended attributes.
|
||||
#
|
||||
# Tue Dec 12 21:55:59 UTC 2017
|
||||
# If possible, use multiple compression threads.
|
||||
#
|
||||
# Wed Sep 23 18:36:43 UTC 2015
|
||||
# Support spaces in file/directory names. <alphageek>
|
||||
#
|
||||
# Sun Apr 5 21:23:26 CDT 2009
|
||||
# Support .tgz, .tbz, .tlz, and .txz packages. <volkerdi>
|
||||
#
|
||||
# Fri Nov 26 13:53:36 GMT 2004
|
||||
# Patched to chmod 755 the package's root directory if needed, then restore
|
||||
# previous permissions after the package has been created. <sw>
|
||||
#
|
||||
# Wed Mar 18 15:32:33 CST 1998
|
||||
# Patched to avoid possible symlink attacks in /tmp.
|
||||
|
||||
CWD=$(pwd)
|
||||
|
||||
umask 022
|
||||
|
||||
make_install_script() {
|
||||
TAB="$(echo -e "\t")"
|
||||
COUNT=1
|
||||
while :; do
|
||||
LINE="$(sed -n "$COUNT p" $1)"
|
||||
if [ "$LINE" = "" ]; then
|
||||
break
|
||||
fi
|
||||
LINKGOESIN="$(echo "$LINE" | cut -f 1 -d "$TAB")"
|
||||
LINKGOESIN="$(dirname "$LINKGOESIN")"
|
||||
LINKNAMEIS="$(echo "$LINE" | cut -f 1 -d "$TAB")"
|
||||
LINKNAMEIS="$(basename "$LINKNAMEIS")"
|
||||
LINKPOINTSTO="$(echo "$LINE" | cut -f 2 -d "$TAB")"
|
||||
echo "( cd $LINKGOESIN ; rm -rf $LINKNAMEIS )"
|
||||
echo "( cd $LINKGOESIN ; ln -sf $LINKPOINTSTO $LINKNAMEIS )"
|
||||
COUNT=$(expr $COUNT + 1)
|
||||
done
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
|
||||
Usage: makepkg package_name.tgz
|
||||
(or: package_name.tbz, package_name.tlz, package_name.txz)
|
||||
|
||||
Makes a Slackware compatible package containing the contents of the current
|
||||
and all subdirectories. If symbolic links exist, they will be removed and
|
||||
an installation script will be made to recreate them later. This script will
|
||||
be called "install/doinst.sh". You may add any of your own ash-compatible
|
||||
shell scripts to this file and rebuild the package if you wish.
|
||||
|
||||
options: -l, --linkadd y|n (moves symlinks into doinst.sh: recommended)
|
||||
-p, --prepend (prepend rather than append symlinks to an existing
|
||||
doinst.sh. Useful to link libraries needed by programs in
|
||||
the doinst.sh script)
|
||||
-c, --chown y|n (resets all permissions to root:root 755 - not
|
||||
generally recommended)
|
||||
--threads <number> For xz/plzip compressed packages, set the max
|
||||
number of threads to be used for compression. Only has an
|
||||
effect on large packages. For plzip, the default is equal to
|
||||
the number of CPU threads available on the machine. For xz,
|
||||
the default is equal to 2 (due to commonly occuring memory
|
||||
related failures when using many threads with multi-threaded
|
||||
xz compression).
|
||||
--compress <option> Supply a custom option to the compressor.
|
||||
This will be used in place of the default, which is: -9
|
||||
--acls Support storing POSIX ACLs in the package. The resulting
|
||||
package will not be compatible with pkgtools version < 15.0.
|
||||
--xattrs Support storing extended attributes in the package. The
|
||||
resulting package will not be compatible with pkgtools
|
||||
version < 15.0.
|
||||
|
||||
If these options are not set, makepkg will prompt if appropriate.
|
||||
EOF
|
||||
}
|
||||
|
||||
TMP=/tmp # This can be a hole, but I'm going to be careful about file
|
||||
# creation in there, so don't panic. :^)
|
||||
|
||||
# Set maximum number of threads to use. By default, this will be the number
|
||||
# of CPU threads:
|
||||
THREADS="$(nproc)"
|
||||
|
||||
# Set default compression option.
|
||||
COMPRESS_OPTION="-9"
|
||||
|
||||
# Parse options
|
||||
unset ACLS XATTRS
|
||||
while [ 0 ]; do
|
||||
if [ "$1" = "--linkadd" -o "$1" = "-l" ]; then
|
||||
if [ "$2" = "y" ]; then
|
||||
LINKADD=y
|
||||
elif [ "$2" = "n" ]; then
|
||||
LINKADD=n
|
||||
else
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
shift 2
|
||||
elif [ "$1" = "--chown" -o "$1" = "-c" ]; then
|
||||
if [ "$2" = "y" ]; then
|
||||
CHOWN=y
|
||||
elif [ "$2" = "n" ]; then
|
||||
CHOWN=n
|
||||
else
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
shift 2
|
||||
elif [ "$1" = "-p" -o "$1" = "--prepend" ]; then
|
||||
PREPEND=y
|
||||
shift 1
|
||||
elif [ "$1" = "-threads" -o "$1" = "--threads" ]; then
|
||||
THREADS="$2"
|
||||
shift 2
|
||||
# xz has memory issues with threads it seems, so we'll use two threads by
|
||||
# default unless we see that something else was user-selected:
|
||||
XZ_THREADS_FORCED=yes
|
||||
elif [ "$1" = "-compress" -o "$1" = "--compress" ]; then
|
||||
COMPRESS_OPTION="$2"
|
||||
shift 2
|
||||
elif [ "$1" = "--acls" ]; then
|
||||
ACLS="--acls"
|
||||
shift 1
|
||||
elif [ "$1" = "--xattrs" ]; then
|
||||
XATTRS="--xattrs"
|
||||
shift 1
|
||||
elif [ "$1" = "-h" -o "$1" = "-H" -o "$1" = "--help" -o $# = 0 ]; then
|
||||
usage
|
||||
exit 0
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
unset MTIME
|
||||
if [ -n "${SOURCE_DATE_EPOCH}" ]; then
|
||||
MTIME="--clamp-mtime --mtime=@${SOURCE_DATE_EPOCH}"
|
||||
fi
|
||||
|
||||
PACKAGE_NAME="$1"
|
||||
TARGET_NAME="$(dirname $PACKAGE_NAME)"
|
||||
PACKAGE_NAME="$(basename $PACKAGE_NAME)"
|
||||
|
||||
# Identify package extension and compression type to use:
|
||||
if [ ! "$(basename $PACKAGE_NAME .tgz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tgz"
|
||||
COMPEXT="gz"
|
||||
COMPRESSOR="gzip ${COMPRESS_OPTION} -cn"
|
||||
if ! which gzip 1> /dev/null 2> /dev/null ; then
|
||||
echo "ERROR: gzip compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tar.gz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tar.gz"
|
||||
COMPRESSOR="gzip ${COMPRESS_OPTION} -cn"
|
||||
if ! which gzip 1> /dev/null 2> /dev/null ; then
|
||||
echo "ERROR: gzip compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tbz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tbz"
|
||||
if which lbzip2 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="lbzip2 ${COMPRESS_OPTION} -c"
|
||||
else
|
||||
if which bzip2 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="bzip2 ${COMPRESS_OPTION} -c"
|
||||
else
|
||||
echo "ERROR: bzip2 compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tar.bz2)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tar.bz2"
|
||||
if which lbzip2 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="lbzip2 ${COMPRESS_OPTION} -c"
|
||||
else
|
||||
if which bzip2 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="bzip2 ${COMPRESS_OPTION} -c"
|
||||
else
|
||||
echo "ERROR: bzip2 compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tlz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tlz"
|
||||
if which plzip 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="plzip ${COMPRESS_OPTION} --threads=${THREADS} -c"
|
||||
else
|
||||
echo "WARNING: plzip compression utility not found in \$PATH."
|
||||
echo "WARNING: package will not support multithreaded decompression."
|
||||
if which lzip 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="lzip ${COMPRESS_OPTION} -c"
|
||||
else
|
||||
echo "ERROR: lzip compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tar.lz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tar.lz"
|
||||
if which plzip 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="plzip ${COMPRESS_OPTION} --threads=${THREADS} -c"
|
||||
else
|
||||
echo "WARNING: plzip compression utility not found in \$PATH."
|
||||
echo "WARNING: package will not support multithreaded decompression."
|
||||
if which lzip 1> /dev/null 2> /dev/null ; then
|
||||
COMPRESSOR="lzip ${COMPRESS_OPTION} -c"
|
||||
else
|
||||
echo "ERROR: lzip compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tar.lzma)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tar.lzma"
|
||||
COMPRESSOR="lzma ${COMPRESS_OPTION} -c"
|
||||
if ! which lzma 1> /dev/null 2> /dev/null ; then
|
||||
echo "ERROR: lzma compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .txz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="txz"
|
||||
if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
|
||||
# Two threads by default with xz due to memory failures on 32-bit. Not that
|
||||
# it matters much... if upstream ever gets around to implementing multi-
|
||||
# threaded decompression we'll revisit this default. :-D
|
||||
COMPRESSOR="xz ${COMPRESS_OPTION} --threads=2 -c"
|
||||
else
|
||||
COMPRESSOR="xz ${COMPRESS_OPTION} --threads=${THREADS} -c"
|
||||
fi
|
||||
if ! which xz 1> /dev/null 2> /dev/null ; then
|
||||
echo "ERROR: xz compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
elif [ ! "$(basename $PACKAGE_NAME .tar.xz)" = "$PACKAGE_NAME" ]; then
|
||||
EXTENSION="tar.xz"
|
||||
if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
|
||||
# Two threads by default with xz due to memory failures on 32-bit. Not that
|
||||
# it matters much... if upstream ever gets around to implementing multi-
|
||||
# threaded decompression we'll revisit this default. :-D
|
||||
COMPRESSOR="xz ${COMPRESS_OPTION} --threads=2 -c"
|
||||
else
|
||||
COMPRESSOR="xz ${COMPRESS_OPTION} --threads=${THREADS} -c"
|
||||
fi
|
||||
if ! which xz 1> /dev/null 2> /dev/null ; then
|
||||
echo "ERROR: xz compression utility not found in \$PATH."
|
||||
exit 3
|
||||
fi
|
||||
else
|
||||
EXTENSION="$(echo $PACKAGE_NAME | rev | cut -f 1 -d . | rev)"
|
||||
echo "ERROR: Package extension .$EXTENSION is not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAR_NAME="$(basename $PACKAGE_NAME .$EXTENSION)"
|
||||
|
||||
# Sanity check -- we can't make the package in the current directory:
|
||||
if [ "$CWD" = "$TARGET_NAME" -o "." = "$TARGET_NAME" ]; then
|
||||
echo "ERROR: Can't make output package in current directory."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Slackware package maker, version 3.14159265."
|
||||
echo
|
||||
echo "Searching for symbolic links:"
|
||||
# Get rid of possible pre-existing trouble:
|
||||
INST=$(mktemp $TMP/makepkg.XXXXXX)
|
||||
# Escape some characters in symlink names:
|
||||
find . -type l -printf "%p\t%l\n" | LC_COLLATE=C sort | sed 's,^\./,,; s,[ "#$&\x27()*;<>?[\\`{|~],\\&,g;' | tee $INST
|
||||
if [ ! "$(cat $INST)" = "" ]; then
|
||||
echo
|
||||
echo "Making symbolic link creation script:"
|
||||
make_install_script $INST | tee doinst.sh
|
||||
fi
|
||||
echo
|
||||
if [ ! "$(cat $INST)" = "" ]; then
|
||||
if [ -r install/doinst.sh ]; then
|
||||
echo "Unless your existing installation script already contains the code"
|
||||
echo "to create these links, you should append these lines to your existing"
|
||||
echo "install script. Now's your chance. :^)"
|
||||
echo
|
||||
echo "Would you like to add this stuff to the existing install script and"
|
||||
echo -n "remove the symbolic links ([y]es, [n]o)? "
|
||||
else
|
||||
echo "It is recommended that you make these lines your new installation script."
|
||||
echo
|
||||
echo "Would you like to make this stuff the install script for this package"
|
||||
echo -n "and remove the symbolic links ([y]es, [n]o)? "
|
||||
fi
|
||||
if [ ! "$LINKADD" ]; then
|
||||
read LINKADD;
|
||||
echo
|
||||
else
|
||||
echo $LINKADD
|
||||
echo
|
||||
fi
|
||||
if [ "$LINKADD" = "y" ]; then
|
||||
if [ -r install/doinst.sh ]; then
|
||||
UPDATE="t"
|
||||
if [ "$PREPEND" = "y" ]; then
|
||||
touch install/doinst.sh
|
||||
mv install/doinst.sh install/doinst.sh.shipped
|
||||
cat doinst.sh > install/doinst.sh
|
||||
echo "" >> install/doinst.sh
|
||||
cat install/doinst.sh.shipped >> install/doinst.sh
|
||||
rm -f install/doinst.sh.shipped
|
||||
else
|
||||
cat doinst.sh >> install/doinst.sh
|
||||
fi
|
||||
else
|
||||
mkdir -p install
|
||||
cat doinst.sh > install/doinst.sh
|
||||
fi
|
||||
echo
|
||||
echo "Removing symbolic links:"
|
||||
find . -type l -exec rm -v {} \;
|
||||
echo
|
||||
if [ "$UPDATE" = "t" ]; then
|
||||
if [ "$PREPEND" = "y" ]; then
|
||||
echo "Updating your ./install/doinst.sh (prepending symlinks)..."
|
||||
else
|
||||
echo "Updating your ./install/doinst.sh..."
|
||||
fi
|
||||
else
|
||||
echo "Creating your new ./install/doinst.sh..."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "No symbolic links were found, so we won't make an installation script."
|
||||
echo "You can make your own later in ./install/doinst.sh and rebuild the"
|
||||
echo "package if you like."
|
||||
fi
|
||||
rm -f doinst.sh $INST
|
||||
echo
|
||||
echo "This next step is optional - you can set the directories in your package"
|
||||
echo "to some sane permissions. If any of the directories in your package have"
|
||||
echo "special permissions, then DO NOT reset them here!"
|
||||
echo
|
||||
echo "Would you like to reset all directory permissions to 755 (drwxr-xr-x) and"
|
||||
echo -n "directory ownerships to root.root ([y]es, [n]o)? "
|
||||
if [ ! "$CHOWN" ]; then
|
||||
read CHOWN;
|
||||
echo
|
||||
else
|
||||
echo $CHOWN
|
||||
echo
|
||||
fi
|
||||
if [ "$CHOWN" = "y" ]; then
|
||||
find . -type d -exec chmod -v 755 {} \;
|
||||
find . -type d -exec chown -v root.root {} \;
|
||||
fi
|
||||
|
||||
# Ensure that the 'root' of the package is chmod 755 because
|
||||
# the / of your filesystem will inherit these permissions.
|
||||
# If it's anything tighter than 755 then bad things happen such as users
|
||||
# not being able to login, users already logged in can no longer run commands
|
||||
# and so on.
|
||||
OLDROOTPERMS="$(find -name . -printf "%m\n")"
|
||||
if [ $OLDROOTPERMS -ne 755 ]; then
|
||||
echo "WARNING: $PWD is chmod $OLDROOTPERMS"
|
||||
echo " temporarily changing to chmod 755"
|
||||
chmod 755 .
|
||||
fi
|
||||
|
||||
echo "Creating Slackware package: ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}"
|
||||
echo
|
||||
rm -f ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
|
||||
|
||||
# HISTORICAL NOTE 2/2018:
|
||||
# In the interest of maximizing portability of this script, we'll use find
|
||||
# and sed to create a filelist compatible with tar-1.13, and then use a
|
||||
# more modern tar version to create the archive.
|
||||
#
|
||||
# Other (but possibly less portable) ways to achieve the same result:
|
||||
#
|
||||
# Use the tar --transform and --show-transformed-names options:
|
||||
# tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | $COMPRESSOR > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
|
||||
#
|
||||
# Use cpio:
|
||||
# find ./ | sed '2,$s,^\./,,' | cpio --quiet -ovHustar > ${TARGET_NAME}/${TAR_NAME}.tar
|
||||
|
||||
# Create the package:
|
||||
find ./ | LC_COLLATE=C sort | sed '2,$s,^\./,,' | tar --no-recursion $ACLS $XATTRS $MTIME -T - -cvf - | $COMPRESSOR > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
|
||||
ERRCODE=$?
|
||||
if [ ! $ERRCODE = 0 ]; then
|
||||
echo "ERROR: $COMPRESSOR returned error code $ERRCODE -- makepkg failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Warn of zero-length files:
|
||||
find . -type f -size 0c | cut -b3- | sed "s/^/WARNING: zero length file /g"
|
||||
|
||||
# Warn of corrupt or empty gzip files:
|
||||
find . -type f -name '*.gz' | while read file ; do
|
||||
if ! gzip -t $file 1> /dev/null 2> /dev/null ; then
|
||||
echo "WARNING: gzip test failed on $(echo $file | cut -b3-)"
|
||||
else
|
||||
if [ "$(gzip -l $file | tail -n 1 | tr -s ' ' | cut -f 3 -d ' ')" -eq 0 ]; then
|
||||
echo "WARNING: $(echo $file | cut -b3-) is an empty gzipped file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Some more handy warnings:
|
||||
if [ -d usr/share/man ]; then
|
||||
echo "WARNING: /usr/share/man (with possibly not gzipped man pages) detected"
|
||||
fi
|
||||
|
||||
if [ -d usr/share/info ]; then
|
||||
echo "WARNING: /usr/share/info (with possibly not gzipped info pages) detected"
|
||||
fi
|
||||
|
||||
if find . | grep site_perl 1> /dev/null ; then
|
||||
echo "WARNING: site_perl directory detected (this is fine for a local package build)"
|
||||
fi
|
||||
|
||||
# Restore the old permissions if they previously weren't chmod 755
|
||||
if [ $OLDROOTPERMS -ne 755 ]; then
|
||||
echo
|
||||
echo "Restoring permissions of $PWD to chmod $OLDROOTPERMS"
|
||||
chmod $OLDROOTPERMS .
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Slackware package ${TARGET_NAME}/${TAR_NAME}.${EXTENSION} created."
|
||||
echo
|
@@ -3,12 +3,15 @@ echo "---Setting umask to ${UMASK}---"
|
||||
umask ${UMASK}
|
||||
|
||||
echo "---Checking for optional scripts---"
|
||||
if [ -f /opt/scripts/user.sh ]; then
|
||||
echo "---Found optional script, executing---"
|
||||
chmod +x /opt/scripts/user.sh
|
||||
/opt/scripts/user.sh
|
||||
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
||||
cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
||||
|
||||
if [ -f /opt/scripts/start-user.sh ]; then
|
||||
echo "---Found optional script, executing---"
|
||||
chmod -f +x /opt/scripts/start-user.sh ||:
|
||||
/opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---"
|
||||
else
|
||||
echo "---No optional script found, continuing---"
|
||||
echo "---No optional script found, continuing---"
|
||||
fi
|
||||
|
||||
echo "root:${ROOT_PWD}" | chpasswd
|
||||
|
Reference in New Issue
Block a user