Initial commit of templates/

This commit is contained in:
Darren 'Tadgy' Austin 2022-09-05 21:12:59 +01:00
commit d438ad2ffb
45 changed files with 3213 additions and 0 deletions

0
templates/cron.d/.empty Normal file
View file

View file

View file

View file

View file

View file

@ -0,0 +1,5 @@
# These are the common settings used in rc.d scripts, but there may be more per script.
# ENVIRONMENT=() # Extra environment passed to $EXEC. Must be an array.
# EXTRA_ARGS=() # Extra arguments passed to $EXEC. Must be an array.
# SLAY_DELAY="" # Delay between the SIGTERM and SIGKILL on a 'stop'. Default: 2s.
# RESTART_DELAY="" # Delay between stopping and starting on a 'restart'. Default: 2s.

77
templates/doinst.sh Normal file
View file

@ -0,0 +1,77 @@
# Version: 0.3.5
# Copyright (c) 2005-2022:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[[ -z "$1" ]] || [[ ! -e "$1" ]] && return
local OLDFILE="${1%.new}"
if [[ ! -e "$OLDFILE" ]]; then
mv "$1" "$OLDFILE"
elif [[ -L "$OLDFILE" ]]; then
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " is a symbolic link - the incoming .new file was not written"
echo " to it in order to prevent clobbering something important."
echo
elif [[ "$(md5sum <"$OLDFILE")" == "$(md5sum <"$1")" ]]; then
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
# Install new configuration files.
install_file "FIXME/FIXME.new"
# List info pages in the directory.
[[ -x usr/bin/install-info ]] && usr/bin/install-info %BUILD_PREFIX%/info/FIXME.info.gz %BUILD_PREFIX%/info/dir
# Add required user/group.
GROUPNAME="FIXME"
GROUPID="FIXME"
USERNAME="FIXME"
USERID="FIXME"
grep "^$GROUPNAME:" etc/group >/dev/null 2>&1 || {
if chroot . usr/sbin/groupadd -g "$GROUPID" -r "$GROUPNAME" && chroot . usr/sbin/grpconv; then
echo "NOTICE: Added new system group: $GROUPNAME ($GROUPID)."
else
echo "WARNING: Failed to add required group: $GROUPNAME."
fi
echo
}
grep "^$USERNAME:" etc/passwd >/dev/null 2>&1 || {
if chroot . usr/sbin/useradd -d "FIXME_HOMEDIR" -g "$GROUPNAME" -M -N -r -s /bin/false -u "$USERID" "$USERNAME" && chroot . usr/sbin/pwconv; then
echo "NOTICE: Added new system user: $USERNAME ($USERID)"
else
echo "WARNING: Failed to add required user: $USERNAME."
fi
echo
}
# Add service start to rc.local
RC="rc.FIXME"
fgrep "/etc/rc.d/$RC" etc/rc.d/rc.local >/dev/null 2>&1 || {
echo >>etc/rc.d/rc.local
echo "[[ -x /etc/rc.d/$RC ]] /etc/rc.d/$RC start" >>etc/rc.d/rc.local
}
# Add service shutdown to rc.local_shutdown
fgrep "/etc/rc.d/$RC" etc/rc.d/rc.local_shutdown >/dev/null 2>&1 || {
# If rc.local_shutdown doesn't exist, create it.
[[ -e etc/rc.d/rc.local_shutdown ]] || {
echo "#!/bin/bash" >etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
}
echo >>etc/rc.d/rc.local_shutdown
echo "[[ -x /etc/rc.d/$RC ]] && /etc/rc.d/$RC stop" >>etc/rc.d/rc.local_shutdown
}
restart cron if a crontab was installed

View file

View file

@ -0,0 +1,74 @@
# Version: 0.2.2
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" ] || [ ! -e "$1" ] && return
local OLDFILE="${1%%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^(/)?\Q$OLDFILE\E(\.new)?(\t)+[[:alnum:]]{32}(\t|$)" \
install/slack-install 2>/dev/null | tr -s '\t' | cut -d$'\t' -f2)"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1
then
cat "$1" >"$OLDFILE"
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE: changed since installation."
echo " Examine the file: $1"
echo " and integrate any required changes into the customised file."
echo
fi
}
remove_file() {
# $1 = Path of item to process (without leading or trailing /)
[ -z "$1" ] || [ ! -e "$1" ] && return
local TYPE="$(stat -c "%F" "$1" | tr [:upper:] [:lower:] | cut -d' ' -f1)"
local MD5S="$(grep -P "^(/)?\Q$1\E(\t)+([[:alnum:]]{32}|DIR|LINK|SPECIAL|FORCE_REMOVE){1}(\t|$)" \
install/slack-remove | tr -s '\t' | cut -d$'\t' -f2)"
if [[ "$TYPE" = "directory" && "$MD5S" =~ "\<DIR\>" ]] || \
[[ "$TYPE" = "symbolic" && "$MD5S" =~ "\<LINK\>" ]] || \
[[ "$TYPE" =~ "(block|character|fifo|socket)" && "$MD5S" =~ "\<SPECIAL\>" ]] || \
[[ "$TYPE" = "regular" && ( "$MD5S" =~ "\<FORCE_REMOVE\>" || \
"$MD5S" =~ "\<$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)\>" ) ]]
then
rm -rf "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $1: not removed."
if [ -z "$MD5S" ]; then
echo " Not found in slack-remove file - cannot verify md5sum/type."
elif [ "$TYPE" = "regular" ]; then
echo " File has been customised since installation."
else
echo " Incorrect special type listed in slack-remove file."
fi
echo
fi
}
install_file FIXME/FIXME.new
remove_file FIXME/FIXME
ldconfig -r .
[ -x usr/bin/install-info ] && \
usr/bin/install-info FIXME/info/FIXME.info.gz FIXME/info/dir
for FILE in $(find FIXME/lib/perl5 -name perllocal.pod.new); do
cat $FILE >>${FILE%%.new} &&
rm -f $FILE
done

View file

@ -0,0 +1,71 @@
# Version: 0.2.3
# Copyright (c) 2005-2013:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" ] || [ ! -e "$1" ] && return
local OLDFILE="${1%%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^(/)?\Q$OLDFILE\E(\.new)?(\t)+[[:alnum:]]{32}(\t|$)" \
install/slack-install 2>/dev/null | tr -s '\t' | cut -d$'\t' -f2)"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1; then
cat "$1" >"$OLDFILE" &&
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
remove_file() {
# $1 = Path of item to process (without leading or trailing /)
[ -z "$1" ] || [ ! -e "$1" ] && return
local TYPE="$(stat -c "%F" "$1" | tr [:upper:] [:lower:] | cut -d' ' -f1)"
local MD5S="$(grep -P "^(/)?\Q$1\E(\t)+([[:alnum:]]{32}|DIR|LINK|SPECIAL|FORCE_REMOVE)(\t|$)" \
install/slack-remove | tr -s '\t' | cut -d$'\t' -f2)"
if [[ "$TYPE" = "directory" && "$MD5S" =~ "\<DIR\>" ]] || \
[[ "$TYPE" = "symbolic" && "$MD5S" =~ "\<LINK\>" ]] || \
[[ "$TYPE" =~ "(block|character|fifo|socket)" && "$MD5S" =~ "\<SPECIAL\>" ]] || \
[[ "$TYPE" = "regular" && "$MD5S" =~ "\<FORCE_REMOVE\>" ]] || \
[[ "$TYPE" = "regular" && "$MD5S" =~ "\<$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)\>" ]]
then
rm -rf "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $1: not removed."
if [ -z "$MD5S" ]; then
echo " Not in slack-remove file - cannot verify md5sum or type."
elif [ "$TYPE" = "regular" ]; then
echo " Customised file - no matching md5sum in slack-remove file."
else
echo " Item does't match special type listed in slack-remove file."
fi
echo
fi
}
install_file FIXME/FIXME.new
remove_file FIXME/FIXME
[ -x usr/bin/install-info ] && \
usr/bin/install-info FIXME/info/FIXME.info.gz FIXME/info/dir
for FILE in $(find FIXME/lib/perl5 -name perllocal.pod.new); do
cat "$FILE" >>"${FILE%%.new}" &&
rm -f "$FILE"
done

View file

@ -0,0 +1,40 @@
# Version: 0.2.4
# Copyright (c) 2005-2013:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" ] || [ ! -e "$1" ] && return
local OLDFILE="${1%%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^[[:alnum:]]{32}(\t)+(/)?\Q${OLDFILE}\E(\.new)?(\t|$)" \
install/slack-install 2>/dev/null | tr -s '\t' | cut -d$'\t' -f2)"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1; then
cat "$1" >"$OLDFILE" &&
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
install_file FIXME/FIXME.new
[ -x usr/bin/install-info ] && \
usr/bin/install-info FIXME/info/FIXME.info.gz FIXME/info/dir
for FILE in $(find FIXME/lib/perl5 -name perllocal.pod.new); do
cat "$FILE" >>"${FILE%%.new}" &&
rm -f "$FILE"
done

View file

@ -0,0 +1,135 @@
# Version: 0.2.6
# Copyright (c) 2005-2017:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" -o ! -e "$1" ] && return
local OLDFILE="${1%%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^[[:alnum:]]{32}[[:blank:]]+(/)?\Q${OLDFILE}\E(\.new)?[[:blank:]]*$" \
install/slack-install | grep -Eo '[[:alnum:]]{32}')"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1; then
cat "$1" >"$OLDFILE" &&
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
install_file "FIXME/FIXME.new"
[ -x usr/bin/install-info ] && \
usr/bin/install-info FIXME/info/FIXME.info.gz FIXME/info/dir
for FILE in "$(find FIXME/lib/perl5 -name perllocal.pod.new)"; do
cat "$FILE" >>"${FILE%%.new}" &&
rm -f "$FILE"
done
# Version: 1.0 GSB doinst.sh - Do not remove this line!
# Copyright (c) 2007, 2008:
# Darren 'Tadgy' Austin <darren (at) gnomeslackbuild.org>, Coventry, UK.
# Steve Kennedy <steve (at) gnomeslackbuild.org>, Exeter, UK.
# Licenced under the terms of the GNU General Public Licence version 3.
#
# Update new libraries
ldconfig -r .
# Preserve new configuration files
function install_file() {
# $1 = File to process
FILE="$(dirname "$1")/$(basename "$1" .new)"
if [ ! -e "$FILE" ]
then
mv "$FILE.new" "$FILE"
elif [ "$(cat "$FILE" | md5sum)" != "$(cat "$FILE.new" | md5sum)" ]
then
# |--------|--------------------------------------------------|
echo "WARNING: $FILE has been customised."
echo " Examine the $FILE.new file"
echo " and integrate any changes into the custom file."
echo
else
rm -f "$FILE.new"
fi
}
install_file FIXME/FIXME.new
# If the FIXME user/group don't exist, add them
if ! grep "^FIXME:" etc/group >/dev/null 2>&1; then
echo "FIXME:x:GID:" >>etc/group
fi
if ! grep "^FIXME:" etc/gshadow >/dev/null 2>&1; then
echo "FIXME:*::" >>etc/gshadow
fi
if ! grep "^FIXME:" etc/passwd >/dev/null 2>&1; then
echo "FIXME:x:UID:GID:FIXME user:/FIXME/HOME/DIR:/bin/false" >>etc/passwd
fi
if grep "^FIXME:" etc/shadow >/dev/null 2>&1; then
echo "FIXME:*:9797:0:::::" >>etc/shadow
fi
# If rc.local doesn't exist, create it
if [ ! -e etc/rc.d/rc.local ]; then
echo "#!/bin/sh" >etc/rc.d/rc.local
chmod 755 etc/rc.d/rc.local
fi
# If rc.local_shutdown doesn't exist, create it
if [ ! -e etc/rc.d/rc.local_shutdown ]; then
echo "#!/bin/sh" >etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
fi
# Add service start to rc.local
if ! grep "/etc/rc.d/rc.FIXME" etc/rc.d/rc.local >/dev/null 2>&1; then
cat <EOF >>etc/rc.d/rc.local
# To disable FIXME, chmod rc.FIXME to 644
if [ -x /etc/rc.d/rc.FIXME ]; then
/etc/rc.d/rc.FIXME start
fi
EOF
fi
# Add service shutdown to rc.local_shutdown
if ! grep "/etc/rc.d/rc.FIXME" etc/rc.d/rc.local_shutdown >/dev/null 2>&1; then
cat <EOF >>etc/rc.d/rc.local_shutdown
if [ -x /etc/rc.d/rc.FIXME ]; then
/etc/rc.d/rc.FIXME stop
fi
EOF
fi
# Install new info files
if [ -x usr/bin/install-info ]; then
usr/bin/install-info usr/info/FIXME.info.gz usr/info/dir >/dev/null 2>&1
fi
# Update desktop database
if [ -x usr/bin/update-desktop-database ]; then
usr/bin/update-desktop-database >/dev/null 2>&1
fi
# Update mime database
if [ -x usr/bin/update-mime-database ]; then
usr/bin/update-mime-database usr/share/mime/ >/dev/null 2>&1
fi
# Restart gconfd-2 to reload new settings
killall -HUP gconfd-2 >/dev/null 2>&1

View file

@ -0,0 +1,77 @@
# Version: 0.3.2
# Copyright (c) 2005-2017:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" -o ! -e "$1" ] && return
local OLDFILE="${1%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^[[:alnum:]]{32}[[:blank:]]+(/)?\Q$OLDFILE\E(\.new)?[[:blank:]]*$" \
install/slack-install | grep -Eo '^[[:alnum:]]{32}')"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1; then
cat "$1" >"$OLDFILE" &&
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
# Install new configuration files.
install_file "FIXME/FIXME.new"
# List info pages in the directory.
[ -x usr/bin/install-info ] && usr/bin/install-info %BUILD_PREFIX%/info/FIXME.info.gz %BUILD_PREFIX%/info/dir
# Add required user/group.
# Note: groups need to be added before users.
grep "^FIXME_GROUPNAME:" etc/group >/dev/null 2>&1 || {
echo "NOTICE: Adding new system group: FIXME_GROUPNAME (FIXME_GID)."
usr/sbin/groupadd -g FIXME_GID -r FIXME_GROUPNAME || echo "WARNING: Failed to create required group (FIXME_GROUPNAME)."
usr/sbin/grpconv # Won't hurt if above failed.
}
grep "^FIXME_USERNAME:" etc/passwd >/dev/null 2>&1 || {
echo "NOTICE: Adding new system user: FIXME_USERNAME (FIXME_UID)"
usr/sbin/useradd -d FIXME_HOMEDIR -g FIXME_GROUPNAME -M -N -r -s /bin/false -u FIXME_UID FIXME_USERNAME || \
echo "WARNING: Failed to create required user (FIXME_USERNAME)."
usr/sbin/pwconv # Won't hurt if above failed.
}
# The old way...
# grep '^FIXME_USERNAME:' etc/passwd >/dev/null 2>&1 || echo 'FIXME_USERNAME:x:FIXME_UID:FIXME_GID:FIXME_USERNAME user:FIXME_HOMEDIR:/bin/false' >>etc/passwd
# grep '^FIXME_USERNAME:' etc/shadow >/dev/null 2>&1 || echo 'FIXME_USERNAME:*:9797:0:::::' >>etc/shadow
# grep '^FIXME_GROUPNAME:' etc/group >/dev/null 2>&1 || echo 'FIXME_GROUPNAME:x:FIXME_GID:' >>etc/group
# grep '^FIXME_GROUPNAME:' etc/gshadow >/dev/null 2>&1 || echo 'FIXME_GROUPNAME:*::' >>etc/gshadow
# Add service start to rc.local
fgrep '/etc/rc.d/rc.FIXME' etc/rc.d/rc.local >/dev/null 2>&1 || {
echo >>etc/rc.d/rc.local
echo 'if [ -x /etc/rc.d/rc.FIXME ]; then' >>etc/rc.d/rc.local
echo ' /etc/rc.d/rc.FIXME start' >>etc/rc.d/rc.local
echo 'fi' >>etc/rc.d/rc.local
}
# If rc.local_shutdown doesn't exist, create it.
[ -e etc/rc.d/rc.local_shutdown ] || {
echo '#!/bin/sh' >etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
}
# Add service shutdown to rc.local_shutdown
fgrep '/etc/rc.d/rc.FIXME' etc/rc.d/rc.local_shutdown || {
echo >>etc/rc.d/rc.local_shutdown
echo 'if [ -x /etc/rc.d/rc.FIXME ]; then' >>etc/rc.d/rc.local_shutdown
echo ' /etc/rc.d/rc.FIXME stop' >>etc/rc.d/rc.local_shutdown
echo 'fi' >>etc/rc.d/rc.local_shutdown
}

View file

@ -0,0 +1,75 @@
# Version: 0.3.3
# Copyright (c) 2005-2017:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" -o ! -e "$1" ] && return
local OLDFILE="${1%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^[[:alnum:]]{32}[[:blank:]]+(/)?\Q$OLDFILE\E(\.new)?[[:blank:]]*$" \
install/slack-install | grep -Eo '^[[:alnum:]]{32}')"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1; then
cat "$1" >"$OLDFILE" &&
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
# Install new configuration files.
install_file "FIXME/FIXME.new"
# List info pages in the directory.
[ -x usr/bin/install-info ] && usr/bin/install-info %BUILD_PREFIX%/info/FIXME.info.gz %BUILD_PREFIX%/info/dir
# Add required user/group.
# Note: groups need to be added before users.
grep "^FIXME_GROUPNAME:" etc/group >/dev/null 2>&1 || {
if chroot . usr/sbin/groupadd -g FIXME_GID -r FIXME_GROUPNAME && chroot . usr/sbin/grpconv; then
echo -e "NOTICE: Added new system group: FIXME_GROUPNAME (FIXME_GID).\n"
else
echo -e "WARNING: Failed to add required group: FIXME_GROUPNAME.\n"
fi
}
grep "^FIXME_USERNAME:" etc/passwd >/dev/null 2>&1 || {
if chroot . usr/sbin/useradd -d FIXME_HOMEDIR -g FIXME_GROUPNAME -M -N -r -s /bin/false -u FIXME_UID FIXME_USERNAME && chroot . usr/sbin/pwconv; then
echo -e "NOTICE: Added new system user: FIXME_USERNAME (FIXME_UID)\n"
else
echo -e "WARNING: Failed to add required user: FIXME_USERNAME.\n"
fi
}
# Add service start to rc.local
fgrep '/etc/rc.d/rc.FIXME' etc/rc.d/rc.local >/dev/null 2>&1 || {
echo >>etc/rc.d/rc.local
echo 'if [ -x /etc/rc.d/rc.FIXME ]; then' >>etc/rc.d/rc.local
echo ' /etc/rc.d/rc.FIXME start' >>etc/rc.d/rc.local
echo 'fi' >>etc/rc.d/rc.local
}
# If rc.local_shutdown doesn't exist, create it.
[ -e etc/rc.d/rc.local_shutdown ] || {
echo '#!/bin/sh' >etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
}
# Add service shutdown to rc.local_shutdown
fgrep '/etc/rc.d/rc.FIXME' etc/rc.d/rc.local_shutdown || {
echo >>etc/rc.d/rc.local_shutdown
echo 'if [ -x /etc/rc.d/rc.FIXME ]; then' >>etc/rc.d/rc.local_shutdown
echo ' /etc/rc.d/rc.FIXME stop' >>etc/rc.d/rc.local_shutdown
echo 'fi' >>etc/rc.d/rc.local_shutdown
}

View file

@ -0,0 +1,75 @@
# Version: 0.3.4
# Copyright (c) 2005-2017:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
install_file() {
# $1 = Path of file to process (without leading /, with .new extension)
[ -z "$1" -o ! -e "$1" ] && return
local OLDFILE="${1%.new}"
local NEWMD5="$(md5sum "$1" 2>/dev/null | cut -d' ' -f1)"
local OLDMD5="$(md5sum "$OLDFILE" 2>/dev/null | cut -d' ' -f1)"
local PREVMD5S="$(grep -P "^[[:alnum:]]{32}[[:blank:]]+(/)?\Q$OLDFILE\E(\.new)?[[:blank:]]*$" \
install/slack-install 2>/dev/null | grep -Eo '^[[:alnum:]]{32}')"
if [ ! -e "$OLDFILE" ]; then
mv "$1" "$OLDFILE"
elif [ "$NEWMD5" = "$OLDMD5" ]; then
rm -f "$1"
elif echo "$PREVMD5S" | grep -v "^$NEWMD5$" | grep "^$OLDMD5$" >/dev/null 2>&1; then
cat "$1" >"$OLDFILE" &&
rm -f "$1"
else
# |--------|-----------------------------------------------------------|
echo "WARNING: $OLDFILE"
echo " has been customised since original installation and was not"
echo " replaced with the incoming .new file."
echo
fi
}
# Install new configuration files.
install_file "FIXME/FIXME.new"
# List info pages in the directory.
[ -x usr/bin/install-info ] && usr/bin/install-info %BUILD_PREFIX%/info/FIXME.info.gz %BUILD_PREFIX%/info/dir
# Add required user/group.
# Note: groups need to be added before users.
grep "^FIXME_GROUPNAME:" etc/group >/dev/null 2>&1 || {
if chroot . usr/sbin/groupadd -g FIXME_GID -r FIXME_GROUPNAME && chroot . usr/sbin/grpconv; then
echo -e "NOTICE: Added new system group: FIXME_GROUPNAME (FIXME_GID).\n"
else
echo -e "WARNING: Failed to add required group: FIXME_GROUPNAME.\n"
fi
}
grep "^FIXME_USERNAME:" etc/passwd >/dev/null 2>&1 || {
if chroot . usr/sbin/useradd -d FIXME_HOMEDIR -g FIXME_GROUPNAME -M -N -r -s /bin/false -u FIXME_UID FIXME_USERNAME && chroot . usr/sbin/pwconv; then
echo -e "NOTICE: Added new system user: FIXME_USERNAME (FIXME_UID)\n"
else
echo -e "WARNING: Failed to add required user: FIXME_USERNAME.\n"
fi
}
# Add service start to rc.local
fgrep '/etc/rc.d/rc.FIXME' etc/rc.d/rc.local >/dev/null 2>&1 || {
echo >>etc/rc.d/rc.local
echo 'if [ -x /etc/rc.d/rc.FIXME ]; then' >>etc/rc.d/rc.local
echo ' /etc/rc.d/rc.FIXME start' >>etc/rc.d/rc.local
echo 'fi' >>etc/rc.d/rc.local
}
# If rc.local_shutdown doesn't exist, create it.
[ -e etc/rc.d/rc.local_shutdown ] || {
echo '#!/bin/sh' >etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
}
# Add service shutdown to rc.local_shutdown
fgrep '/etc/rc.d/rc.FIXME' etc/rc.d/rc.local_shutdown || {
echo >>etc/rc.d/rc.local_shutdown
echo 'if [ -x /etc/rc.d/rc.FIXME ]; then' >>etc/rc.d/rc.local_shutdown
echo ' /etc/rc.d/rc.FIXME stop' >>etc/rc.d/rc.local_shutdown
echo 'fi' >>etc/rc.d/rc.local_shutdown
}

View file

@ -0,0 +1,110 @@
#!/bin/bash
# Version: 0.2.5
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
EXEC=""
ARGS=""
PIDFILE=""
checkconfigured() {
# This function can be used to perform any pre-start tests; hopfully to insure the daemon
# can start correctly, before actually trying to start it. A return value of 0 means the
# tests were passed and the daemon should be started. Any other value prevents the
# daemon from being started and will emit an error message.
return 0
}
checkstatus() {
local RUNPIDS="$(pidof -o $$ -o $PPID -o %PPID -x "$EXEC" 2>/dev/null)"
if [ ! -z "$RUNPIDS" ]; then
echo -n "${BASH_SOURCE##*/}: ${EXEC##*/}: running"
if [ ! -z "$PIDFILE" ]; then
if [ ! -e "$PIDFILE" ]; then
echo -n ", but .pid file does not exist"
elif ! echo "$RUNPIDS" | grep "\<$(< "$PIDFILE")\>" >/dev/null 2>&1; then
echo -n ", but .pid file is stale"
fi
fi
echo
else
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: stopped"
return 1
fi
return 0
}
startdaemon() {
if ! checkconfigured; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not started - pre-start tests failed" >&2
return 1
elif [ ! -e "$EXEC" ]; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not found" >&2
return 1
elif [ ! -x "$EXEC" ]; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not executable" >&2
return 1
fi
"$EXEC" $ARGS
return $?
}
stopdaemon() {
if ! kill -TERM $(cat "$PIDFILE" 2>/dev/null) >/dev/null 2>&1; then
kill -TERM $(pidof -o $$ -o $PPID -o %PPID -x "$EXEC") >/dev/null 2>&1
fi
sleep 2
if checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: failed to stop gracefully - slaying" >&2
kill -KILL $(pidof -o $$ -o $PPID -o %PPID -x "$EXEC") >/dev/null 2>&1
sleep 2
if checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: failed to stop after SIGKILL" >&2
return 1
fi
fi
return 0
}
case "$1" in
'start')
if checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: already running" >&2
echo " Try: $BASH_SOURCE status" >&2
ERR=1
else
startdaemon
ERR=$?
fi
;;
'stop')
if ! checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not running" >&2
echo " Try: $BASH_SOURCE status" >&2
ERR=1
else
stopdaemon
ERR=$?
fi
;;
'restart')
if checkstatus >/dev/null; then
stopdaemon && startdaemon
ERR=$?
else
startdaemon
ERR=$?
fi
;;
'status')
checkstatus
ERR=$?
;;
*)
echo "Usage: $BASH_SOURCE <start|stop|restart|status>" >&2
ERR=1
;;
esac
return $ERR 2>/dev/null || exit $ERR

View file

@ -0,0 +1,105 @@
#!/bin/bash
# Version: 0.2.8
# Copyright (c) 2005-2017:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
EXEC=""
ARGS=""
PIDFILE=""
checkconfigured() {
# This function can be used to perform any pre-start tests; hopfully to insure the daemon
# can start correctly, before actually trying to start it. A return value of 0 means the
# tests were passed and the daemon should be started. Any other value prevents the
# daemon from being started and an error message will be emitted.
return 0
}
checkstatus() {
local RUNPIDS="$(pgrep -f "$EXEC")"
if [ ! -z "$RUNPIDS" ]; then
echo -n "${BASH_SOURCE##*/}: ${EXEC##*/}: running"
if [ ! -z "$PIDFILE" ]; then
if [ ! -e "$PIDFILE" ]; then
echo -n ", but .pid file does not exist"
elif ! echo "$RUNPIDS" | grep "\<$(cat "$PIDFILE")\>" >/dev/null 2>&1; then
echo -n ", but .pid file is stale"
fi
fi
echo
else
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: stopped"
return 1
fi
return 0
}
startdaemon() {
if ! checkconfigured; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not started - pre-start checks failed" >&2
return 1
elif [ ! -e "$EXEC" ]; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not found" >&2
return 1
elif [ ! -x "$EXEC" ]; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not executable" >&2
return 1
fi
"$EXEC" $ARGS
return $?
}
stopdaemon() {
if ! kill -TERM "$(cat "$PIDFILE" 2>/dev/null)" >/dev/null 2>&1; then
kill -TERM "$(pgrep -f "$EXEC")" >/dev/null 2>&1
fi
sleep 2
if checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: failed to stop gracefully - slaying" >&2
kill -KILL "$(pgrep -f "$EXEC")" >/dev/null 2>&1
fi
return 0
}
case "$1" in
'start')
if checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: already running" >&2
echo " Try: $BASH_SOURCE status" >&2
ERR=1
else
startdaemon
ERR=$?
fi
;;
'stop')
if ! checkstatus >/dev/null; then
echo "${BASH_SOURCE##*/}: ${EXEC##*/}: not running" >&2
echo " Try: $BASH_SOURCE status" >&2
ERR=1
else
stopdaemon
ERR=$?
fi
;;
'restart')
if checkstatus >/dev/null; then
stopdaemon && sleep 2 && startdaemon
ERR=$?
else
startdaemon
ERR=$?
fi
;;
'status')
checkstatus
ERR=$?
;;
*)
echo "Usage: $BASH_SOURCE <start|stop|restart|status>" >&2
ERR=1
;;
esac
return $ERR 2>/dev/null || exit $ERR

View file

@ -0,0 +1,9 @@
# Version: 0.2.0
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Packages which may conflict with other installed packages can be listed here.
# For example, 'lprng' conflicts with 'cups' as they are both printing systems.
# Packages must be listed one per line and are case sensitive.
# No versioning information should be used.

View file

@ -0,0 +1,6 @@
# Version: 0.2.2
# This is the list of packages which, if installed, will conflict with the
# package currently being installed. For example, 'lprng' conflicts with
# 'cups' as they are both printing systems.
# Packages must be listed one per line and are case sensitive. No versioning
# information should be used. This file is only used by slapt-get.

View file

@ -0,0 +1,23 @@
# Version: 0.2.0
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# How to use:
# * Line up the first '|' of the ruler with the ':' following the package name.
# The second '|' is the last colum any characters should be put in.
# * There must be exactly 11 lines which begin with the package name and ':'.
# * A single space should be left after the ':' before any description text.
|-----handy-ruler------------------------------------------------------|
FIXME: FIXME (FIXME)
FIXME:
FIXME:
FIXME:
FIXME:
FIXME:
FIXME:
FIXME:
FIXME:
FIXME:
FIXME: Packaged by: Darren Austin. Built with: %PKG_DIST%

View file

@ -0,0 +1,15 @@
# Version: 0.2.0
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# This file should list md5sums for all previous versions of a file which is to
# be copied into place using the install_file() function in doinst.sh, and is
# used to determine if an incoming (.new) file should replace a file already
# present on the system. Each entry should have the format:
# <filename> <md5sum> [comment]
# and each of the elements must be separated by one or more tabs, not spaces.
# There can be multiple <filename> entries, each with a different <md5sum>; but
# each line must contain at least a filename and md5sum. The [comment] field
# is optional, but could be used to detail the source of that md5sum - eg, the
# Slackware version, package name and version.

View file

@ -0,0 +1,10 @@
# Version: 0.2.2
# This file lists the md5sums for all previous versions of a file which is to
# be copied into place using the install_file() function in doinst.sh, and is
# used to help determine if an incoming (.new) file should replace a file
# already on the system. Entries should be one per line, in the format:
# <filename> <md5sum> [comment]
# where each field must be separated by one or more tabs, *not* spaces.
# Multiple entries per <filename>, each with a different <md5sum> can be listed.
# Lines which do not contain at least <filename> and <md5sum> are ignored; as is
# the optional free form [comment] field always ignored.

View file

@ -0,0 +1,10 @@
# Version: 0.2.3
# This file lists the md5sums for all previous versions of a file which is to
# be copied into place using the install_file() function in doinst.sh, and is
# used to help determine if an incoming (.new) file should replace a file
# already on the system. Entries should be one per line, in the format:
# <md5sum> <filename> [comment]
# where each field *must* be separated by one or more tabs, *not* spaces.
# Multiple entries per <filename>, each with a different <md5sum> can be listed.
# Lines which do not contain at least <filename> and <md5sum> are ignored, as is
# the optional free form [comment] field.

View file

@ -0,0 +1,10 @@
# Version: 0.2.4
# This file lists the md5sums for all previous versions of a file which is to
# be copied into place using the install_file() function in doinst.sh, and is
# used to help determine if an incoming (.new) file should replace a file
# already on the system. Entries should be one per line, in the format:
# <md5sum> <filename>
# where each field must be separated by any amount of whitespace,
# Multiple entries per <filename>, each with a different <md5sum> can be listed.
# Lines which do not contain at least <filename> and <md5sum> are ignored.
# The output of 'md5sum' is appropriate for an entry in this file.

View file

@ -0,0 +1,24 @@
# Version: 0.1.0
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# This file should list md5sums (or special type, see below) for files/paths
# which are to be deleted from the system using the remove_file() function in
# doinst.sh. The file/path will only be removed if the corresponding <md5sum>
# or special type matches that of the item on the system. The md5sum or type
# check prevents the deletion of any files which may have been customised by
# the administrator. Each entry should have the format:
# <path> <md5sum> [comment]
# and each of the elements must be separated by one or more tabs, not spaces.
# If the <path> to be removed is not a regular file, the corresponding <md5sum>
# entry should be one of the following special types (must be in upper case):
# DIR - for a directory (Note: will be removed with rm -rf!)
# LINK - for a symbolic link (Note: only the symbolic link is removed)
# SPECIAL - for sockets, fifos, char/block devices, etc.
# FORCE_REMOVE - force a regular file to be deleted without doing any md5sum
# checks, but only if the <path> is a regular file.
# Paths which are not regular files on the system, and have not been marked
# with the correct special type will not be removed. The [comment] field is
# optional, but could be used to detail the source of the <md5sum> - eg, the
# Slackware version, package name and version.

View file

@ -0,0 +1,18 @@
# Version: 0.2.2
# This file lists the md5sums or special file type for any paths to be deleted
# using the remove_file() function in doinst.sh. The entries are used to verify
# that a path can be safely removed. Entries are one per line, in the format:
# <path> <md5sum> [comment]
# where each field must be separated by one or more tabs, *not* spaces.
# Multiple entries per <path>, each with a different <md5sum> can be listed.
# The free form [comment] field is optional and always ignored, as are lines
# which do not contain at least <path> and <md5sum>.
# For a regular file at <path> to be deleted, the <md5sum> must match the sum of
# that file on the filesystem, or be set as the FORCE_REMOVE special file type.
# If the <path> to be removed is not a regular file, the <md5sum> should be one
# of the following special file types, which must be listed in upper case:
# DIR - for a directory. Note: will be removed with rm -rf!
# LINK - for a symbolic link. Note: only the symbolic link is removed.
# SPECIAL - for sockets, fifos, char/block devices, etc.
# FORCE_REMOVE - force a regular file to be deleted without any checking of the
# <md5sum> - but only if <path> is a regular file.

View file

@ -0,0 +1,16 @@
# Version: 0.2.1
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required packages are those additional packages that are specifically needed
# for the contents of this package to operate correctly.
# For example, 'spamassassin' requires the 'perl' package, as it's perl based.
# Packages must be listed one per line and are case sensitive. If multiple
# packages can satisfy the dependancy (such as 'openssl' or 'openssl-solibs')
# the packages should be listed in the format (where '|' means 'OR'):
# <pkg1> | <pkg2> [| <pkg3> ...]
# Specific package versions can be specified using = >= =< < > operators.
# For the = operator, the version must be the full package version string (eg,
# 1.2.3-i486-1xx). For the >= =< < > operators, the short package version
# (eg, 1.2.3) or the full version string can be used.

View file

@ -0,0 +1,16 @@
# Version: 0.2.0
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Suggested packages are those that may be beneficial or provide extra features
# or functionality to this package.
# For example, the 'php' adds features to the 'apache' webserver package.
# Packages must be listed one per line and are case sensitive. If multiple
# packages can satisfy the dependancy (such as 'openssl' or 'openssl-solibs')
# the packages should be listed in the format (where '|' means 'OR'):
# <pkg1> | <pkg2> [| <pkg3> ...]
# Specific package versions can be specified using = >= =< < > operators.
# For the = >= =< operators, the version must be the full package version
# string (eg, 1.2.3-i486-1). For the < > operators, the short package version
# (eg, 1.2.3) or the full version strings can be used.

View file

@ -0,0 +1,226 @@
#!/bin/bash
# Version: 0.4.3
# Copyright (c) 2005-2011:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME
#
# Source details.
SRC_NAME=""
SRC_DELIM=""
SRC_VERSION=""
SRC_EXT="tar.gz"
# Package details.
PKG_NAME="$SRC_NAME"
PKG_VERSION="$SRC_VERSION"
PKG_BUILD=""
PKG_TAG=""
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
# Build setup.
if [ -e $(cd ${BASH_SOURCE%/*}; pwd -P)/../build.options ]; then
source $(cd ${BASH_SOURCE%/*}; pwd -P)/../build.options || exit 1
fi
BUILD_PREFIX="${BUILD_PREFIX:-/usr}"
BUILD_WORKDIR="${TMP:-/tmp}/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
if [[ "$(arch)" = i[456]86 ]]; then
BUILD_CFLAGS="${BUILD_CFLAGS:--march=i486 -mtune=i686 -O2}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-}"
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j2}"
PKG_ARCH="i486"
PKG_DIST="Slackware"
elif [ "$(arch)" = "x86_64" ]; then
BUILD_CFLAGS="${BUILD_CFLAGS:--march=athlon64 -mtune=core2 -O2 -fPIC}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-64}"
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j4}"
PKG_ARCH="x86_64"
PKG_DIST="Slackware64"
else
echo "${0##*/}: $(arch): unsupported architecture."
exit 1
fi
PKG_DIST="$PKG_DIST $(cut -d' ' -f2 /etc/slackware-version 2>/dev/null | cut -d. -f1,2)"
PKG_STORE="$(cd ${PKG_STORE:-../../packages}; pwd -P)"
SRC_DIR="$(pwd)"
while [ $# -gt 0 ]; do
if [[ "$1" =~ ^-{1,2}f(orce)?$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-{1,2}n(o-cleanup)?$ ]]; then
BUILD_NOCLEANUP=1
else
echo "Usage: ${0##*/} [--force] [--no-cleanup]"; exit 1
fi
shift
done
if [ "$BUILD_FORCE" != "1" ]; then
check_installed() {
# $1 = Package name to match [required].
ls -1 /var/log/packages | grep -P "^\Q${1}\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo "${0##*/}: Required package '$PKG' not installed."; exit 1
fi
done
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo "${0##*/}: Conflicting package '$PKG' installed."; exit 1
fi
done
fi
umask 0022 &&
rm -rf $BUILD_ROOT $BUILD_WORKDIR/$SRC_NAME$SRC_DELIM$SRC_VERSION &&
mkdir -p -m 750 $BUILD_WORKDIR &&
mkdir -m 755 $BUILD_ROOT || exit 1
case $SRC_EXT in
tar.gz|tgz) DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) DECOMP="bzip2" ;;&
tar.xz|tar.lz|txz|tlz) DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv --$DECOMP -C $BUILD_WORKDIR \
-f $SRC_DIR/$SRC_NAME$SRC_DELIM$SRC_VERSION.$SRC_EXT || exit 1 ;;
zip|ZIP) unzip -d $BUILD_WORKDIR \
$SRC_DIR/$SRC_NAME$SRC_DELIM$SRC_VERSION.$SRC_EXT || exit 1 ;;
*) echo "${0##*/}: $SRC_EXT: unknown archive format."; exit 1 ;;
esac
cd $BUILD_WORKDIR/$SRC_NAME$SRC_DELIM$SRC_VERSION &&
chown -R root:root . &&
chmod -R go-w . || exit 1
#........1.........2.........3.........4.........5.........6.........7.........8.........9*........0.........1.........2
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="$BUILD_CFLAGS" ./configure --prefix=$BUILD_PREFIX \
--libdir=$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX --sysconfdir=/etc/$PKG_NAME \
--localstatedir=/var --mandir=$BUILD_PREFIX/man --infodir=$BUILD_PREFIX/info \
--docdir=$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION --build=$PKG_ARCH-slackware-linux \
--enable-shared --disable-static \
FIXME &&
make $BUILD_MAKEFLAGS &&
make $BUILD_MAKEFLAGS DESTDIR=$BUILD_ROOT install || exit 1
mkdir -p -m 755 $BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION &&
cp FIXME \
$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
for FILE in $(ls -1d $SRC_DIR/profile.d/* $SRC_DIR/rc.d/* 2>/dev/null); do
DIR="$(dirname $FILE | sed -e "s:^$SRC_DIR:$BUILD_ROOT/etc:")"
mkdir -p -m 755 $DIR &&
cat $FILE | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
>$DIR/${FILE##*/} &&
chmod --reference=$FILE $DIR/${FILE##*/} || exit 1
done
mkdir -m 755 $BUILD_ROOT/install &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [ -e $SRC_DIR/$FILE ]; then
egrep -v '^#|^$' $SRC_DIR/$FILE | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:$PKG_TAG:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
-e "s:%PKG_DIST%:$PKG_DIST:g" \
-e "s:%PKG_STORE%:$PKG_STORE:g" >$BUILD_ROOT/install/$FILE || exit 1
fi
done
for DIR in $BUILD_ROOT/$BUILD_PREFIX/share/man $BUILD_ROOT/usr/share/man \
$BUILD_ROOT/$BUILD_PREFIX/share/info $BUILD_ROOT/usr/share/info
do
if [ -e $DIR ]; then
mkdir -p -m 755 $BUILD_ROOT/$BUILD_PREFIX/${DIR##*/} &&
cp -aR $DIR/* $BUILD_ROOT/$BUILD_PREFIX/${DIR##*/} &&
rm -rf $DIR || exit 1
fi
done
find $BUILD_ROOT | xargs -r file | egrep "ELF.*(executable|shared object)" | \
cut -d: -f1 | xargs -r strip --strip-unneeded || exit 1
if [ -e $BUILD_ROOT/$BUILD_PREFIX/man ]; then
find $BUILD_ROOT/$BUILD_PREFIX/man -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | \
xargs -r gzip -9 &&
find $BUILD_ROOT/$BUILD_PREFIX/man -type l -printf 'if [ -e %h/%l.gz ];
then (cd %h && ln -sf %l.gz %f.gz && rm -f %f) || exit 1;
elif [ ! -e %h/%l ]; then echo "Dangling symlink: %p"; exit 1; fi\n' | \
bash || exit 1
fi
if [ -e $BUILD_ROOT/$BUILD_PREFIX/info ]; then
find $BUILD_ROOT/$BUILD_PREFIX/info -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | \
xargs -r gzip -9 &&
rm -f $BUILD_ROOT/$BUILD_PREFIX/info/dir &&
find $BUILD_ROOT/$BUILD_PREFIX/info -type l -printf 'if [ -e %h/%l.gz ];
then (cd %h && ln -sf %l.gz %f.gz && rm -f %f) || exit 1;
elif [ ! -e %h/%l ]; then echo "Dangling symlink: %p"; exit 1; fi\n' | \
bash || exit 1
fi
if ls $BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl* >/dev/null 2>&1; then
find $BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl* -name .packlist | \
xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find $BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl* -name perllocal.pod | \
xargs -r -I{} mv {} {}.new || exit 1
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRC_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd $BUILD_ROOT/opt &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e ${BUILD_PREFIX##*/}/$DIR ]; then
mkdir -m 755 $DIR &&
(cd $DIR && lndir -silent ../${BUILD_PREFIX##*/}/$DIR) || exit 1
fi
done
) || exit 1
fi
cd $BUILD_ROOT &&
rm -f $BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.* &&
makepkg -l y -p -c n \
$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.$PKG_EXT &&
cat install/slack-desc | egrep -v '^#|^$|^ ' | egrep "[[:alnum:]]+:" \
>$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.txt || exit 1
mkdir -p -m 755 $PKG_STORE &&
mv -b $BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.{$PKG_EXT,txt} \
$PKG_STORE || exit 1
if [ "$BUILD_NOCLEANUP" != "1" ]; then
rm -rf $BUILD_ROOT $BUILD_WORKDIR/$SRC_NAME$SRC_DELIM$SRC_VERSION
fi
echo
echo -e "\\033[1;32mPackage built:\n\
$(ls $PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.$PKG_EXT)\\033[0;39m"

View file

@ -0,0 +1,226 @@
#!/bin/bash
# Version: 0.4.4
# Copyright (c) 2005-2016:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME
#
# Source details.
SRC_NAME=""
SRC_DELIM=""
SRC_VERSION=""
SRC_EXT="tar.gz"
# Package details.
PKG_NAME="$SRC_NAME"
PKG_VERSION="$SRC_VERSION"
PKG_BUILD=""
PKG_TAG="da"
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
# Build setup.
if [ -e $(cd ${BASH_SOURCE%/*}; pwd -P)/../build.options ]; then
source $(cd ${BASH_SOURCE%/*}; pwd -P)/../build.options || exit 1
fi
BUILD_PREFIX="${BUILD_PREFIX:-/usr}"
BUILD_WORKDIR="${TMP:-/tmp}/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
if [[ "$(arch)" == i[456]86 ]]; then
BUILD_CFLAGS="${BUILD_CFLAGS:--march=i486 -mtune=i686 -O2}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-}"
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j2}"
PKG_ARCH="i486"
PKG_DIST="Slackware"
elif [ "$(arch)" = "x86_64" ]; then
BUILD_CFLAGS="${BUILD_CFLAGS:--march=athlon64 -mtune=core2 -O2 -fPIC}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-64}"
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j4}"
PKG_ARCH="x86_64"
PKG_DIST="Slackware64"
else
echo "${0##*/}: $(arch): unsupported architecture."
exit 1
fi
PKG_DIST="$PKG_DIST $(cut -d' ' -f2 /etc/slackware-version 2>/dev/null | cut -d. -f1,2)"
PKG_STORE="$(cd ${PKG_STORE:-../../packages}; pwd -P)"
SRC_DIR="$(pwd)"
while [ $# -gt 0 ]; do
if [[ "$1" =~ ^-{1,2}f(orce)?$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-{1,2}n(o-cleanup)?$ ]]; then
BUILD_NOCLEANUP=1
else
echo "Usage: ${0##*/} [--force] [--no-cleanup]"; exit 1
fi
shift
done
if [ "$BUILD_FORCE" != "1" ]; then
check_installed() {
# $1 = Package name to match [required].
ls -1 /var/log/packages | grep -P "^\Q${1}\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo "${0##*/}: Required package '$PKG' not installed."; exit 1
fi
done
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo "${0##*/}: Conflicting package '$PKG' installed."; exit 1
fi
done
fi
umask 0022 &&
rm -rf $BUILD_ROOT $BUILD_WORKDIR/$SRC_NAME$SRC_DELIM$SRC_VERSION &&
mkdir -p -m 750 $BUILD_WORKDIR &&
mkdir -m 755 $BUILD_ROOT || exit 1
case $SRC_EXT in
tar.gz|tgz) DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) DECOMP="bzip2" ;;&
tar.xz|tar.lz|txz|tlz) DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv --$DECOMP -C $BUILD_WORKDIR \
-f $SRC_DIR/$SRC_NAME$SRC_DELIM$SRC_VERSION.$SRC_EXT || exit 1 ;;
zip|ZIP) unzip -d $BUILD_WORKDIR \
$SRC_DIR/$SRC_NAME$SRC_DELIM$SRC_VERSION.$SRC_EXT || exit 1 ;;
*) echo "${0##*/}: $SRC_EXT: unknown archive format."; exit 1 ;;
esac
cd $BUILD_WORKDIR/$SRC_NAME$SRC_DELIM$SRC_VERSION &&
chown -R root:root . &&
chmod -R go-w . || exit 1
#........1.........2.........3.........4.........5.........6.........7.........8.........9.........0.........1.........2...
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="$BUILD_CFLAGS" ./configure --prefix=$BUILD_PREFIX \
--libdir=$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX --sysconfdir=/etc/$PKG_NAME \
--localstatedir=/var --mandir=$BUILD_PREFIX/man --infodir=$BUILD_PREFIX/info \
--docdir=$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION --build=$PKG_ARCH-slackware-linux \
--enable-shared --disable-static \
FIXME &&
make $BUILD_MAKEFLAGS &&
make $BUILD_MAKEFLAGS DESTDIR=$BUILD_ROOT install || exit 1
mkdir -p -m 755 $BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION &&
cp FIXME \
$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
for FILE in $(ls -1d $SRC_DIR/profile.d/* $SRC_DIR/rc.d/* 2>/dev/null); do
DIR="$(dirname $FILE | sed -e "s:^$SRC_DIR:$BUILD_ROOT/etc:")"
mkdir -p -m 755 $DIR &&
cat $FILE | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
>$DIR/${FILE##*/} &&
chmod --reference=$FILE $DIR/${FILE##*/} || exit 1
done
mkdir -m 755 $BUILD_ROOT/install &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [ -e $SRC_DIR/$FILE ]; then
egrep -v '^#|^$' $SRC_DIR/$FILE | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:$PKG_TAG:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
-e "s:%PKG_DIST%:$PKG_DIST:g" \
-e "s:%PKG_STORE%:$PKG_STORE:g" >$BUILD_ROOT/install/$FILE || exit 1
fi
done
for DIR in $BUILD_ROOT/$BUILD_PREFIX/share/man $BUILD_ROOT/usr/share/man \
$BUILD_ROOT/$BUILD_PREFIX/share/info $BUILD_ROOT/usr/share/info
do
if [ -e $DIR ]; then
mkdir -p -m 755 $BUILD_ROOT/$BUILD_PREFIX/${DIR##*/} &&
cp -aR $DIR/* $BUILD_ROOT/$BUILD_PREFIX/${DIR##*/} &&
rm -rf $DIR || exit 1
fi
done
find $BUILD_ROOT | xargs -r file | egrep "ELF.*(executable|shared object)" | \
cut -d: -f1 | xargs -r strip --strip-unneeded || exit 1
if [ -e $BUILD_ROOT/$BUILD_PREFIX/man ]; then
find $BUILD_ROOT/$BUILD_PREFIX/man -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | \
xargs -r gzip -9 &&
find $BUILD_ROOT/$BUILD_PREFIX/man -type l -printf 'if [ -e %h/%l.gz ];
then (cd %h && ln -sf %l.gz %f.gz && rm -f %f) || exit 1;
elif [ ! -e %h/%l ]; then echo "Dangling symlink: %p"; exit 1; fi\n' | \
bash || exit 1
fi
if [ -e $BUILD_ROOT/$BUILD_PREFIX/info ]; then
find $BUILD_ROOT/$BUILD_PREFIX/info -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | \
xargs -r gzip -9 &&
rm -f $BUILD_ROOT/$BUILD_PREFIX/info/dir &&
find $BUILD_ROOT/$BUILD_PREFIX/info -type l -printf 'if [ -e %h/%l.gz ];
then (cd %h && ln -sf %l.gz %f.gz && rm -f %f) || exit 1;
elif [ ! -e %h/%l ]; then echo "Dangling symlink: %p"; exit 1; fi\n' | \
bash || exit 1
fi
if ls $BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl* >/dev/null 2>&1; then
find $BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl* -name .packlist | \
xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find $BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl* -name perllocal.pod | \
xargs -r -I{} mv {} {}.new || exit 1
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRC_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd $BUILD_ROOT/opt &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e ${BUILD_PREFIX##*/}/$DIR ]; then
mkdir -m 755 $DIR &&
(cd $DIR && lndir -silent ../${BUILD_PREFIX##*/}/$DIR) || exit 1
fi
done
) || exit 1
fi
cd $BUILD_ROOT &&
rm -f $BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.* &&
makepkg -l y -p -c n \
$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.$PKG_EXT &&
cat install/slack-desc | egrep -v '^#|^$|^ ' | egrep "[[:alnum:]]+:" \
>$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.txt || exit 1
mkdir -p -m 755 $PKG_STORE &&
mv -b $BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.{$PKG_EXT,txt} \
$PKG_STORE || exit 1
if [ "$BUILD_NOCLEANUP" != "1" ]; then
rm -rf $BUILD_ROOT $BUILD_WORKDIR/$SRC_NAME$SRC_DELIM$SRC_VERSION
fi
echo
echo -e "\\033[1;32mPackage built:\n\
$(ls $PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD$PKG_TAG.$PKG_EXT)\\033[0;39m"

View file

@ -0,0 +1,240 @@
#!/bin/bash
# Version: 0.5.0
# Copyright (c) 2005-2016:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME
#
# Source file details.
SRCFILE_NAME=""
SRCFILE_DELIM=""
SRCFILE_VERSION=""
SRCFILE_EXT=""
# Unpacked source directory details.
SRCDIR_NAME="$SRCFILE_NAME"
SRCDIR_DELIM="$SRCFILE_DELIM"
SRCDIR_VERSION="$SRCFILE_VERSION"
# Built package details.
PKG_NAME="$(basename "$BASH_SOURCE" .SlackBuild)"
PKG_VERSION="${SRCFILE_VERSION:-$SRCDIR_VERSION}"
PKG_BUILD=""
PKG_TAG="_da"
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
#........1.........2.........3.........4.........5.........6.........7.........8.........9.........0.........1.........2
cd $(cd "${BASH_SOURCE%/*}"; pwd -P)
while [[ $# -gt 0 ]]; do
if [[ "$1" =~ ^-(-)?(f|force)$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-(-)?(n|no-cleanup)$ ]]; then
BUILD_NOCLEANUP=1
else
echo "Usage: ${0##*/} [-f|--force] [-n|--no-cleanup]"; exit 1
fi
shift
done
if [[ "$BUILD_FORCE" != "1" ]]; then
check_installed() {
ls -1 /var/log/packages | grep -P "^\Q${1}\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo "${0##*/}: Conflicting package '$PKG' installed."; exit 1
fi
done
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo "${0##*/}: Required package '$PKG' not installed."; exit 1
fi
done
fi
declare BUILD_OS_$(grep "^ID=" /etc/os-release)
declare BUILD_OS_$(grep "^VERSION_ID=" /etc/os-release)
[[ -e ../build.options ]] && {
. ../build.options || exit 1
}
BUILD_WORKDIR="${BUILD_WORKDIR:-/tmp}/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
BUILD_PREFIX="${BUILD_PREFIX:-/usr}" # Slackware standard prefix.
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j6}"
case "${BUILD_ARCH:=$(uname -m)}" in
i[45]86)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=$BUILD_ARCH -mtune=${BUILD_TUNE:-i686} -O2}"
PKG_ARCH="$BUILD_ARCH"
;;
i686)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=$BUILD_ARCH -mtune=${BUILD_TUNE:-pentium4} -O2}"
PKG_ARCH="$BUILD_ARCH"
;;
x86_64|x86-64)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=x86-64 -mtune=${BUILD_TUNE:-core2} -O2 -fPIC}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-64}"
PKG_ARCH="x86_64"
;;
*)
echo "${0##*/}: ${BUILD_ARCH:-$(uname -m)}: unsupported architecture."; exit 1
;;
esac
PKG_STORE="$(cd ${PKG_STORE:-../../packages}; pwd -P)/$BUILD_OS_ID$BUILD_LIBDIRSUFFIX-$BUILD_OS_VERSION_ID"
SRC_DIR="$(pwd)"
umask 0022 &&
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
mkdir -p -m 750 "$BUILD_WORKDIR" &&
mkdir -m 755 "$BUILD_ROOT" || exit 1
case "$SRCFILE_EXT" in
tar.gz|tgz) SRCFILE_DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) SRCFILE_DECOMP="bzip2" ;;&
tar.xz|tar.lz|txz|tlz) SRCFILE_DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv "--$SRCFILE_DECOMP" -C "$BUILD_WORKDIR" \
-f "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
zip|ZIP) unzip -d "$BUILD_WORKDIR" "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
*) echo "${0##*/}: $SRCFILE_EXT: unknown archive format."; exit 1 ;;
esac
cd "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
chown -R root:root . &&
chmod -R go-w . || exit 1
# zcat $SRC_DIR/FIXME.patch.gz | patch -p0 || exit 1
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}" LDFLAGS="$BUILD_LDFLAGS" \
./configure --prefix="$BUILD_PREFIX" --libdir="$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX" \
--sysconfdir="/etc/$PKG_NAME" --localstatedir="/var" --mandir="$BUILD_PREFIX/man" \
--infodir="$BUILD_PREFIX/info" --docdir="$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" \
--build="$PKG_ARCH-slackware-linux" --enable-shared --disable-static \
FIXME &&
make "$BUILD_MAKEFLAGS" &&
make "$BUILD_MAKEFLAGS" DESTDIR="$BUILD_ROOT" install || exit 1
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" &&
cp FIXME \
"$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/rc.d" &&
# cat "$SRC_DIR/rc.FIXME" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" >"$BUILD_ROOT/etc/rc.d/rc.FIXME" &&
# chmod 755 "$BUILD_ROOT/etc/rc.d/rc.FIXME" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/profile.d" &&
# for FILE in "$SRC_DIR/FIXME.{csh,sh}"; do
# cat "$FILE" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" | sed -e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
# >"$BUILD_ROOT/etc/profile.d/${FILE##*/}" &&
# chmod 755 "$BUILD_ROOT/etc/profile.d/${FILE##*/}" || exit 1
# done
# mkdir -p -m 755 "$BUILD_ROOT/etc/logrotate.d" &&
# cat "$SRC_DIR/FIXME.logrotate" >"$BUILD_ROOT/etc/logrotate.d/FIXME" || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
find "$BUILD_ROOT" | xargs -r file | egrep "ELF.*(executable|shared object)" | cut -d: -f1 | \
xargs -r strip --strip-unneeded || exit 1
for DIR in "$BUILD_ROOT/$BUILD_PREFIX/share/man" "$BUILD_ROOT/usr/share/man" \
"$BUILD_ROOT/$BUILD_PREFIX/share/info" "$BUILD_ROOT/usr/share/info"
do
if [[ -e "$DIR" ]]; then
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
cp -aR "$DIR/*" "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
rm -rf "$DIR" || exit 1
fi
done
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/man" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/man" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | \
xargs -r gzip -9 &&
find "$BUILD_ROOT/$BUILD_PREFIX/man" -type l -printf ' \
if [ -e "%h/%l.gz" ]; then (cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1; \
elif [ ! -e "%h/%l" ]; then echo 'Dangling symlink: %p'; exit 1; fi\n' | bash || exit 1
fi
if [ -e "$BUILD_ROOT/$BUILD_PREFIX/info" ]; then
find "$BUILD_ROOT/$BUILD_PREFIX/info" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | \
xargs -r gzip -9 &&
rm -f "$BUILD_ROOT/$BUILD_PREFIX/info/dir" &&
find "$BUILD_ROOT/$BUILD_PREFIX/info" -type l -printf ' \
if [ -e "%h/%l.gz" ]; then (cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1; \
elif [ ! -e "%h/%l" ]; then echo 'Dangling symlink: %p'; exit 1; fi\n' | bash || exit 1
fi
if ls "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" >/dev/null 2>&1; then
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" -name .packlist | \
xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" -name perllocal.pod | \
xargs -r -I{} mv {} {}.new || exit 1
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRCFILE_NAME|$SRCDIR_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd "$BUILD_ROOT/opt" &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e "${BUILD_PREFIX##*/}/$DIR" ]; then
mkdir -m 755 "$DIR" &&
(cd "$DIR" && lndir -silent "../${BUILD_PREFIX##*/}/$DIR)" || exit 1
fi
done
) || exit 1
fi
mkdir -m 755 "$BUILD_ROOT/install" &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [[ -e "$SRC_DIR/$FILE" ]]; then
egrep -v '^#|^$' "$SRC_DIR/$FILE" | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%BUILD_OS_ID%:$BUILD_OS_ID:g" \
-e "s:%BUILD_OS_VERSION%_ID:$BUILD_OS_VERSION_ID:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:${PKG_TAG//-/_}:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
>"$BUILD_ROOT/install/$FILE" || exit 1
fi
done
cd "$BUILD_ROOT" &&
rm -f "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.*" &&
makepkg -l y -p -c n "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" &&
cat install/slack-desc | egrep -v '^#|^$|^ ' | egrep "[[:alnum:]]+:" \
>"$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.txt" || exit 1
mkdir -p -m 755 "$PKG_STORE" &&
mv -b "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.{$PKG_EXT,txt}" \
"$PKG_STORE" || exit 1
if [ "$BUILD_NOCLEANUP" != "1" ]; then
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION"
fi
echo
echo -e "\\033[1;32mPackage built:\n\
$(ls "$PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}}.$PKG_EXT")\\033[0;39m"

View file

@ -0,0 +1,246 @@
#!/bin/bash
# Version: 0.5.1
# Copyright (c) 2005-2016:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME: FIXME
#
# Source file details.
SRCFILE_NAME=""
SRCFILE_DELIM=""
SRCFILE_VERSION=""
SRCFILE_EXT=""
# Unpacked source directory details.
SRCDIR_NAME="$SRCFILE_NAME"
SRCDIR_DELIM="$SRCFILE_DELIM"
SRCDIR_VERSION="$SRCFILE_VERSION"
# Built package details.
PKG_NAME="$(basename "$BASH_SOURCE" .SlackBuild)"
PKG_VERSION="${SRCFILE_VERSION:-$SRCDIR_VERSION}"
PKG_BUILD="1"
PKG_TAG="_da"
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
#........1.........2.........3.........4.........5.........6.........7.........8.........9.........0.........1.........2.........3.........4
cd "$(cd "${BASH_SOURCE%/*}"; pwd -P)"
while [[ $# -gt 0 ]]; do
if [[ "$1" =~ ^-(-)?(f|force)$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-(-)?(n|no-cleanup)$ ]]; then
BUILD_NOCLEANUP=1
else
echo "Usage: ${0##*/} [-f|--force] [-n|--no-cleanup]"; exit 1
fi
shift
done
if [[ "$BUILD_FORCE" != "1" ]]; then
check_installed() {
ls -1 /var/log/packages | grep -P "^\Q$1\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo "${0##*/}: Conflicting package '$PKG' installed."; exit 1
fi
done
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo "${0##*/}: Required package '$PKG' not installed."; exit 1
fi
done
fi
declare BUILD_OS_$(grep "^ID=" /etc/os-release)
declare BUILD_OS_$(grep "^VERSION_ID=" /etc/os-release)
[[ -e ../build.options ]] && {
. ../build.options || exit 1
}
BUILD_WORKDIR="${BUILD_WORKDIR:-/tmp}/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
BUILD_PREFIX="${BUILD_PREFIX:-/usr}" # Slackware standard prefix.
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j6}"
case "${BUILD_ARCH:=$(uname -m)}" in
i[45]86)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=$BUILD_ARCH -mtune=${BUILD_TUNE:-i686} -O2}"
PKG_ARCH="$BUILD_ARCH"
;;
i686)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=$BUILD_ARCH -mtune=${BUILD_TUNE:-pentium4} -O2}"
PKG_ARCH="$BUILD_ARCH"
;;
x86_64|x86-64)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=x86-64 -mtune=${BUILD_TUNE:-core2} -O2 -fPIC}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-64}"
PKG_ARCH="x86_64"
;;
*)
echo "${0##*/}: ${BUILD_ARCH:-$(uname -m)}: unsupported architecture."; exit 1
;;
esac
PKG_STORE="${PKG_STORE:-/tmp/pkg-store/$BUILD_OS_ID$BUILD_LIBDIRSUFFIX-$BUILD_OS_VERSION_ID}"
SRC_DIR="$(pwd)"
umask 0022 &&
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
mkdir -p -m 750 "$BUILD_WORKDIR" &&
mkdir -m 755 "$BUILD_ROOT" || exit 1
case "$SRCFILE_EXT" in
tar.gz|tgz) SRCFILE_DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) SRCFILE_DECOMP="bzip2" ;;&
tar.xz|tar.lz|txz|tlz) SRCFILE_DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv "--$SRCFILE_DECOMP" -C "$BUILD_WORKDIR" \
-f "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
zip|ZIP) unzip -d "$BUILD_WORKDIR" "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
*) echo "${0##*/}: $SRCFILE_EXT: unknown archive format."; exit 1 ;;
esac
cd "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
chown -R root:root . &&
chmod -R go-w . || exit 1
# zcat $SRC_DIR/FIXME.patch.gz | patch -p0 || exit 1
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}" LDFLAGS="$BUILD_LDFLAGS" \
./configure --prefix="$BUILD_PREFIX" --libdir="$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX" \
--sysconfdir="/etc/$PKG_NAME" --localstatedir="/var" --mandir="$BUILD_PREFIX/man" \
--infodir="$BUILD_PREFIX/info" --docdir="$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" \
--build="$PKG_ARCH-slackware-linux" --enable-shared --disable-static \
FIXME &&
make "$BUILD_MAKEFLAGS" &&
make "$BUILD_MAKEFLAGS" DESTDIR="$BUILD_ROOT" install || exit 1
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" &&
cp FIXME \
"$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/rc.d" &&
# cat "$SRC_DIR/rc.FIXME" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" >"$BUILD_ROOT/etc/rc.d/rc.FIXME" &&
# chmod 755 "$BUILD_ROOT/etc/rc.d/rc.FIXME" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/profile.d" &&
# for FILE in "$SRC_DIR/FIXME.{csh,sh}"; do
# cat "$FILE" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" | sed -e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
# >"$BUILD_ROOT/etc/profile.d/${FILE##*/}" &&
# chmod 755 "$BUILD_ROOT/etc/profile.d/${FILE##*/}" || exit 1
# done
# mkdir -p -m 755 "$BUILD_ROOT/etc/logrotate.d" &&
# cat "$SRC_DIR/FIXME.logrotate" >"$BUILD_ROOT/etc/logrotate.d/FIXME" || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
find "$BUILD_ROOT" | xargs -r file | egrep "ELF.*(executable|shared object)" | cut -d: -f1 | \
xargs -r strip --strip-unneeded || exit 1
for DIR in "$BUILD_ROOT/$BUILD_PREFIX/share/man" "$BUILD_ROOT/usr/share/man" \
"$BUILD_ROOT/$BUILD_PREFIX/share/info" "$BUILD_ROOT/usr/share/info"
do
if [[ -e "$DIR" ]]; then
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
cp -aR "$DIR/*" "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
rm -rf "$DIR" || exit 1
fi
done
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/man" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/man" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | \
xargs -r gzip -9 &&
find "$BUILD_ROOT/$BUILD_PREFIX/man" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo "Dangling symlink: %p"; exit 1
fi\n' | bash -x || exit 1
fi
if [ -e "$BUILD_ROOT/$BUILD_PREFIX/info" ]; then
find "$BUILD_ROOT/$BUILD_PREFIX/info" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | \
xargs -r gzip -9 &&
rm -f "$BUILD_ROOT/$BUILD_PREFIX/info/dir" &&
find "$BUILD_ROOT/$BUILD_PREFIX/info" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo "Dangling symlink: %p"; exit 1
fi\n' | bash -x || exit 1
fi
if ls "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" >/dev/null 2>&1; then
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" -name .packlist | \
xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" -name perllocal.pod | \
xargs -r -I{} mv {} {}.new || exit 1
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRCFILE_NAME|$SRCDIR_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd "$BUILD_ROOT/opt" &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e "${BUILD_PREFIX##*/}/$DIR" ]; then
mkdir -m 755 "$DIR" &&
(cd "$DIR" && lndir -silent "../${BUILD_PREFIX##*/}/$DIR)") || exit 1
fi
done
) || exit 1
fi
mkdir -m 755 "$BUILD_ROOT/install" &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [[ -e "$SRC_DIR/$FILE" ]]; then
egrep -v '^#|^$' "$SRC_DIR/$FILE" | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%BUILD_OS_ID%:$BUILD_OS_ID:g" \
-e "s:%BUILD_OS_VERSION_ID%:$BUILD_OS_VERSION_ID:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:${PKG_TAG//-/_}:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
>"$BUILD_ROOT/install/$FILE" || exit 1
fi
done
cd "$BUILD_ROOT" &&
rm -f "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.*" &&
makepkg -l y -p -c n "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" &&
cat install/slack-desc | egrep -v '^#|^$|^ ' | egrep "[[:alnum:]]+:" \
>"$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.txt" || exit 1
mkdir -p -m 755 "$PKG_STORE" &&
mv -b "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}".{"$PKG_EXT",txt} \
"$PKG_STORE" || exit 1
if [[ "$BUILD_NOCLEANUP" != "1" ]]; then
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION"
fi
echo
echo -e "\\033[1;32mPackage built:\n " \
"$(ls "$PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT")\\033[0;39m"

View file

@ -0,0 +1,250 @@
#!/bin/bash
# Version: 0.5.1
# Copyright (c) 2005-2016:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME: FIXME
#
# Source file details.
SRCFILE_NAME=""
SRCFILE_DELIM=""
SRCFILE_VERSION=""
SRCFILE_EXT=""
# Unpacked source directory details.
SRCDIR_NAME="$SRCFILE_NAME"
SRCDIR_DELIM="$SRCFILE_DELIM"
SRCDIR_VERSION="$SRCFILE_VERSION"
# Built package details.
PKG_NAME="$(basename "$BASH_SOURCE" .SlackBuild)"
PKG_VERSION="${SRCFILE_VERSION:-$SRCDIR_VERSION}"
PKG_BUILD="1"
PKG_TAG="_da"
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
#........1.........2.........3.........4.........5.........6.........7.........8.........9.........0.........1.........2.........3.........4
cd "$(cd "${BASH_SOURCE%/*}"; pwd -P)"
while [[ $# -gt 0 ]]; do
if [[ "$1" =~ ^-(-)?(f|force)$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-(-)?(n|no-cleanup)$ ]]; then
BUILD_NOCLEANUP=1
elif [[ "$1" =~ ^-(-)?(v|version)$ ]]; then
echo "VERSION=\"$PKG_VERSION\""
echo "BUILD=\"$PKG_BUILD$PKG_TAG\""
exit 0
else
echo "Usage: ${0##*/} [[-f|--force]|[-n|--no-cleanup]|[-v|--version]]"; exit 1
fi
shift
done
if (( "${BUILD_FORCE:-0}" != 1 )); then
check_installed() {
ls -1 /var/log/packages | grep -P "^\Q$1\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo "${0##*/}: Conflicting package '$PKG' installed."; exit 1
fi
done
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo "${0##*/}: Required package '$PKG' not installed."; exit 1
fi
done
fi
declare BUILD_OS_$(grep "^ID=" /etc/os-release)
declare BUILD_OS_$(grep "^VERSION_ID=" /etc/os-release)
[[ -e ../build.options ]] && {
. ../build.options || exit 1
}
BUILD_WORKDIR="${BUILD_WORKDIR:-/tmp}/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
BUILD_PREFIX="${BUILD_PREFIX:-/usr}" # Slackware standard prefix.
BUILD_MAKEFLAGS="${BUILD_MAKEFLAGS:--j6}"
case "${BUILD_ARCH:=$(uname -m)}" in
i[45]86)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=$BUILD_ARCH -mtune=${BUILD_TUNE:-i686} -O2}"
PKG_ARCH="$BUILD_ARCH"
;;
i686)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=$BUILD_ARCH -mtune=${BUILD_TUNE:-pentium4} -O2}"
PKG_ARCH="$BUILD_ARCH"
;;
x86_64|x86-64)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=x86-64 -mtune=${BUILD_TUNE:-core2} -O2 -fPIC}"
BUILD_LIBDIRSUFFIX="${BUILD_LIBDIRSUFFIX:-64}"
PKG_ARCH="x86_64"
;;
*)
echo "${0##*/}: ${BUILD_ARCH:-$(uname -m)}: unsupported architecture."; exit 1
;;
esac
PKG_STORE="${PKG_STORE:-/tmp/pkg-store/$BUILD_OS_ID$BUILD_LIBDIRSUFFIX-$BUILD_OS_VERSION_ID}"
SRC_DIR="$(pwd)"
umask 0022 &&
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
mkdir -p -m 750 "$BUILD_WORKDIR" &&
mkdir -m 755 "$BUILD_ROOT" || exit 1
case "$SRCFILE_EXT" in
tar.gz|tgz) SRCFILE_DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) SRCFILE_DECOMP="bzip2" ;;&
tar.xz|tar.lz|txz|tlz) SRCFILE_DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv "--$SRCFILE_DECOMP" -C "$BUILD_WORKDIR" \
-f "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
zip|ZIP) unzip -d "$BUILD_WORKDIR" "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
*) echo "${0##*/}: $SRCFILE_EXT: unknown archive format."; exit 1 ;;
esac
cd "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
chown -R root:root . &&
chmod -R go-w . || exit 1
# zcat $SRC_DIR/FIXME.patch.gz | patch -p0 || exit 1
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}" LDFLAGS="$BUILD_LDFLAGS" \
./configure --prefix="$BUILD_PREFIX" --libdir="$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX" \
--sysconfdir="/etc/$PKG_NAME" --localstatedir="/var" --mandir="$BUILD_PREFIX/man" \
--infodir="$BUILD_PREFIX/info" --docdir="$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" \
--build="$PKG_ARCH-slackware-linux" --enable-shared --disable-static \
FIXME &&
make "$BUILD_MAKEFLAGS" &&
make "$BUILD_MAKEFLAGS" DESTDIR="$BUILD_ROOT" install || exit 1
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" &&
cp FIXME \
"$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/rc.d" &&
# cat "$SRC_DIR/rc.FIXME" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" >"$BUILD_ROOT/etc/rc.d/rc.FIXME" &&
# chmod 755 "$BUILD_ROOT/etc/rc.d/rc.FIXME" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/profile.d" &&
# for FILE in "$SRC_DIR/FIXME.{csh,sh}"; do
# cat "$FILE" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" | sed -e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
# >"$BUILD_ROOT/etc/profile.d/${FILE##*/}" &&
# chmod 755 "$BUILD_ROOT/etc/profile.d/${FILE##*/}" || exit 1
# done
# mkdir -p -m 755 "$BUILD_ROOT/etc/logrotate.d" &&
# cat "$SRC_DIR/FIXME.logrotate" >"$BUILD_ROOT/etc/logrotate.d/FIXME" || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
find "$BUILD_ROOT" | xargs -r file | egrep "ELF.*(executable|shared object)" | cut -d: -f1 | \
xargs -r strip --strip-unneeded || exit 1
for DIR in "$BUILD_ROOT/$BUILD_PREFIX/share/man" "$BUILD_ROOT/usr/share/man" \
"$BUILD_ROOT/$BUILD_PREFIX/share/info" "$BUILD_ROOT/usr/share/info"
do
if [[ -e "$DIR" ]]; then
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
cp -aR "$DIR/*" "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
rm -rf "$DIR" || exit 1
fi
done
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/man" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/man" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | \
xargs -r gzip -9 &&
find "$BUILD_ROOT/$BUILD_PREFIX/man" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo "Dangling symlink: %p"; exit 1
fi\n' | bash -x || exit 1
fi
if [ -e "$BUILD_ROOT/$BUILD_PREFIX/info" ]; then
find "$BUILD_ROOT/$BUILD_PREFIX/info" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | \
xargs -r gzip -9 &&
rm -f "$BUILD_ROOT/$BUILD_PREFIX/info/dir" &&
find "$BUILD_ROOT/$BUILD_PREFIX/info" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo "Dangling symlink: %p"; exit 1
fi\n' | bash -x || exit 1
fi
if ls "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" >/dev/null 2>&1; then
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" -name .packlist | \
xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl*" -name perllocal.pod | \
xargs -r -I{} mv {} {}.new || exit 1
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRCFILE_NAME|$SRCDIR_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd "$BUILD_ROOT/opt" &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e "${BUILD_PREFIX##*/}/$DIR" ]; then
mkdir -m 755 "$DIR" &&
(cd "$DIR" && lndir -silent "../${BUILD_PREFIX##*/}/$DIR)") || exit 1
fi
done
) || exit 1
fi
mkdir -m 755 "$BUILD_ROOT/install" &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [[ -e "$SRC_DIR/$FILE" ]]; then
egrep -v '^#|^$' "$SRC_DIR/$FILE" | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%BUILD_OS_ID%:$BUILD_OS_ID:g" \
-e "s:%BUILD_OS_VERSION_ID%:$BUILD_OS_VERSION_ID:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:${PKG_TAG//-/_}:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
>"$BUILD_ROOT/install/$FILE" || exit 1
fi
done
cd "$BUILD_ROOT" &&
rm -f "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.*" &&
makepkg -l y -p -c n "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" &&
cat install/slack-desc | egrep -v '^#|^$|^ ' | egrep "[[:alnum:]]+:" \
>"$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.txt" || exit 1
mkdir -p -m 755 "$PKG_STORE" &&
mv -b "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}".{"$PKG_EXT",txt} \
"$PKG_STORE" || exit 1
if [[ "$BUILD_NOCLEANUP" != "1" ]]; then
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION"
fi
echo
echo -e "\\033[1;32mPackage built:\n " \
"$(ls "$PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT")\\033[0;39m"

View file

@ -0,0 +1,253 @@
#!/bin/bash
# Version: 0.5.4
# Copyright (c) 2005-2017:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME: FIXME
#
# Source file details.
SRCFILE_NAME=""
SRCFILE_DELIM=""
SRCFILE_VERSION=""
SRCFILE_EXT=""
# Unpacked source directory details.
SRCDIR_NAME="$SRCFILE_NAME"
SRCDIR_DELIM="$SRCFILE_DELIM"
SRCDIR_VERSION="$SRCFILE_VERSION"
# Built package details.
PKG_NAME="$(basename "$BASH_SOURCE" .SlackBuild)"
PKG_VERSION="${SRCFILE_VERSION:-$SRCDIR_VERSION}"
PKG_BUILD="1"
PKG_TAG="_da"
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
#........1.........2.........3.........4.........5.........6.........7.........8.........9.........0.........1.........2.........3.....:...4
cd "$(cd "${BASH_SOURCE%/*}"; pwd -P)"
while [[ $# -gt 0 ]]; do
if [[ "$1" =~ ^-(-)?(f|force)$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-(-)?(n|no-cleanup)$ ]]; then
BUILD_NOCLEANUP=1
elif [[ "$1" =~ ^-(-)?(v|version)$ ]]; then
echo "NAME=\"$PKG_NAME\""
echo "VERSION=\"$PKG_VERSION\""
echo "BUILD=\"$PKG_BUILD$PKG_TAG\""
exit 0
else
echo "Usage: ${0##*/} [[-f|--force]|[-n|--no-cleanup]|[-v|--version]]"; exit 1
fi
shift
done
if (( "${BUILD_FORCE:-0}" != 1 )); then
check_installed() {
ls -1 /var/log/packages | grep -P "^\Q$1\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo -e "\\033[1;31m${0##*/}: Conflicting package '$PKG' installed.\\033[0;39m"; exit 1
fi
done
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo -e "\\033[1;31m${0##*/}: Required package '$PKG' not installed.\\033[0;39m"; exit 1
fi
done
fi
declare BUILD_OS_$(grep "^ID=" /etc/os-release)
declare BUILD_OS_$(grep "^VERSION_ID=" /etc/os-release)
BUILD_WORKDIR="/tmp/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
BUILD_PREFIX="/usr" # Slackware standard prefix.
BUILD_MAKEFLAGS="-j5"
case "${BUILD_ARCH:=$(uname -m)}" in
i[45]86)
BUILD_CFLAGS="-march=$BUILD_ARCH -mtune=i686 -O2"
PKG_ARCH="$BUILD_ARCH"
;;
i686)
BUILD_CFLAGS="-march=$BUILD_ARCH -mtune=pentium4 -O2"
PKG_ARCH="$BUILD_ARCH"
;;
x86_64|x86-64)
BUILD_CFLAGS="-march=x86-64 -mtune=core2 -O2 -fPIC"
BUILD_LIBDIRSUFFIX="64"
PKG_ARCH="x86_64"
;;
*)
echo -e "\\033[1;31m${0##*/}: $(uname -m): unsupported architecture.\\033[0;39m"; exit 1
;;
esac
PKG_STORE="/tmp/pkg-store/$BUILD_OS_ID$BUILD_LIBDIRSUFFIX-$BUILD_OS_VERSION_ID"
[[ -e ../build.options ]] && {
. ../build.options || exit 1
}
SRC_DIR="$(pwd)"
umask 0022 &&
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
mkdir -p -m 750 "$BUILD_WORKDIR" &&
mkdir -m 755 "$BUILD_ROOT" || exit 1
case "$SRCFILE_EXT" in
tar.gz|tgz) SRCFILE_DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) SRCFILE_DECOMP="bzip2" ;;&
tar.xz|tar.lz|txz|tlz) SRCFILE_DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv "--$SRCFILE_DECOMP" -C "$BUILD_WORKDIR" \
-f "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
zip|ZIP) unzip -d "$BUILD_WORKDIR" "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
*) echo -e "\\033[1;31m${0##*/}: $SRCFILE_EXT: unknown archive format.\\033[0;39m"; exit 1 ;;
esac
cd "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
chown -R root:root . &&
chmod -R go-w . || exit 1
# zcat $SRC_DIR/FIXME.patch.gz | patch -p0 || exit 1
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}" LDFLAGS="$BUILD_LDFLAGS" ./configure --prefix="$BUILD_PREFIX" \
--libdir="$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX" --sysconfdir="/etc/$PKG_NAME" --localstatedir="/var" --mandir="$BUILD_PREFIX/man" \
--infodir="$BUILD_PREFIX/info" --docdir="$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" --build="$PKG_ARCH-slackware-linux" \
--enable-shared --disable-static \
FIXME &&
make "$BUILD_MAKEFLAGS" &&
make "$BUILD_MAKEFLAGS" DESTDIR="$BUILD_ROOT" install || exit 1
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" &&
cp FIXME \
"$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/rc.d" &&
# cat "$SRC_DIR/rc.FIXME" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" >"$BUILD_ROOT/etc/rc.d/rc.FIXME" &&
# chmod 755 "$BUILD_ROOT/etc/rc.d/rc.FIXME" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/profile.d" &&
# for FILE in "$SRC_DIR/FIXME.{csh,sh}"; do
# cat "$FILE" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" | sed -e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
# >"$BUILD_ROOT/etc/profile.d/${FILE##*/}" &&
# chmod 755 "$BUILD_ROOT/etc/profile.d/${FILE##*/}" || exit 1
# done
# mkdir -p -m 755 "$BUILD_ROOT/etc/logrotate.d" &&
# cat "$SRC_DIR/FIXME.logrotate" >"$BUILD_ROOT/etc/logrotate.d/FIXME" || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
HARDLINKS="$(find $BUILD_ROOT -type f -links +1)"
if [[ ! -z "$HARDLINKS" ]]; then
echo -e "\\033[1;31mFound hardlinked files:\\033[0;39m"
echo -e "\\033[1;31m$HARDLINKS\\033[0;39m"
exit 1
fi
find "$BUILD_ROOT" | xargs -r file | egrep "ELF.*(executable|shared object)" | cut -d: -f1 | xargs -r strip --strip-unneeded || exit 1
for DIR in "$BUILD_ROOT/$BUILD_PREFIX/share/man" "$BUILD_ROOT/usr/share/man" "$BUILD_ROOT/$BUILD_PREFIX/share/info" \
"$BUILD_ROOT/usr/share/info"
do
if [[ -e "$DIR" ]]; then
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
cp -aR "$DIR/"* "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
rm -rf "$DIR" || exit 1
fi
done
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/man" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/man" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | xargs -r gzip -9 &&
find "$BUILD_ROOT/$BUILD_PREFIX/man" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo -e "\\033[1;31mDangling symlink: %p\\033[0;39m"; exit 1
fi\n' | bash -x || exit 1
fi
if [ -e "$BUILD_ROOT/$BUILD_PREFIX/info" ]; then
find "$BUILD_ROOT/$BUILD_PREFIX/info" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | xargs -r gzip -9 &&
rm -f "$BUILD_ROOT/$BUILD_PREFIX/info/dir" &&
find "$BUILD_ROOT/$BUILD_PREFIX/info" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo -e "\\033[1;31mDangling symlink: %p\\033[0;39m"; exit 1
fi\n' | bash -x || exit 1
fi
if ls "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" >/dev/null 2>&1; then
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" -name .packlist | xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" -name perllocal.pod | \
xargs -r -I{} mv {} {}.new || exit 1
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRCFILE_NAME|$SRCDIR_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd "$BUILD_ROOT/opt" &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e "${BUILD_PREFIX##*/}/$DIR" ]; then
mkdir -m 755 "$DIR" &&
(cd "$DIR" && lndir -silent "../${BUILD_PREFIX##*/}/$DIR)") || exit 1
fi
done
) || exit 1
fi
mkdir -m 755 "$BUILD_ROOT/install" &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [[ -e "$SRC_DIR/$FILE" ]]; then
egrep -v '^#|^$' "$SRC_DIR/$FILE" | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%BUILD_OS_ID%:$BUILD_OS_ID:g" \
-e "s:%BUILD_OS_VERSION_ID%:$BUILD_OS_VERSION_ID:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:${PKG_TAG//-/_}:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
>"$BUILD_ROOT/install/$FILE" || exit 1
fi
done
cd "$BUILD_ROOT" &&
rm -f "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}."* &&
makepkg -l y -p -c n "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" &&
cat install/slack-desc | egrep -v '^#|^$|^ ' | egrep "[[:alnum:]]+:" \
>"$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.txt" || exit 1
mkdir -p -m 755 "$PKG_STORE" &&
mv -b "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}".{"$PKG_EXT",txt} \
"$PKG_STORE" || exit 1
if [[ "$BUILD_NOCLEANUP" != "1" ]]; then
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION"
fi
echo -e "\\033[1;32mPackage built:\n " \
"$(ls "$PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT")\\033[0;39m"

View file

@ -0,0 +1,255 @@
#!/bin/bash
# Version: 0.5.7
# Copyright (c) 2005-2022:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# Required sources:
# FIXME: FIXME
#
# Source file details.
SRCFILE_NAME=""
SRCFILE_DELIM=""
SRCFILE_VERSION=""
SRCFILE_EXT=""
# Unpacked source directory details.
SRCDIR_NAME="$SRCFILE_NAME"
SRCDIR_DELIM="$SRCFILE_DELIM"
SRCDIR_VERSION="$SRCFILE_VERSION"
# Built package details.
PKG_NAME="$(basename "$BASH_SOURCE" .SlackBuild)"
PKG_VERSION="${SRCFILE_VERSION:-$SRCDIR_VERSION}"
PKG_BUILD="1"
PKG_TAG="_tadgy"
PKG_EXT="txz"
# Packages which must be installed to build.
BUILD_REQUIRED=""
# Packages which must not be installed to build.
BUILD_CONFLICTS="$PKG_NAME"
#........1.........2.........3.........4.........5.........6.........7.........8.........9.........0.........1.........2.........3.....:...4
cd "$(cd "${BASH_SOURCE%/*}"; pwd -P)"
while [[ $# -gt 0 ]]; do
if [[ "$1" =~ ^-(-)?(f|force)$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-(-)?(n|no-cleanup)$ ]]; then
BUILD_NOCLEANUP=1
elif [[ "$1" =~ ^-(-)?(v|version)$ ]]; then
echo "NAME=\"$PKG_NAME\""
echo "VERSION=\"$PKG_VERSION\""
echo "BUILD=\"$PKG_BUILD$PKG_TAG\""
exit 0
else
echo "Usage: ${0##*/} [[-f|--force]|[-n|--no-cleanup]|[-v|--version]]"; exit 1
fi
shift
done
if (( "${BUILD_FORCE:-0}" != 1 )); then
check_installed() {
ls -1 /var/log/packages | grep -P "^\Q$1\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
for PKG in $BUILD_CONFLICTS; do
if check_installed "$PKG"; then
echo -e "\\033[1;31m${0##*/}: Conflicting package '$PKG' installed.\\033[0;39m"; exit 1
fi
done
for PKG in $BUILD_REQUIRED; do
if ! check_installed "$PKG"; then
echo -e "\\033[1;31m${0##*/}: Required package '$PKG' not installed.\\033[0;39m"; exit 1
fi
done
fi
declare BUILD_OS_$(grep "^ID=" /etc/os-release)
declare BUILD_OS_$(grep "^VERSION_ID=" /etc/os-release)
BUILD_WORKDIR="/tmp/pkg-build"
BUILD_ROOT="$BUILD_WORKDIR/$PKG_NAME"
BUILD_PREFIX="/usr" # Slackware standard prefix.
BUILD_MAKEFLAGS="-j5"
case "${BUILD_ARCH:=$(uname -m)}" in
i[45]86)
BUILD_CFLAGS="-march=$BUILD_ARCH -mtune=i686 -O2"
PKG_ARCH="$BUILD_ARCH"
;;
i686)
BUILD_CFLAGS="-march=$BUILD_ARCH -mtune=pentium4 -O2"
PKG_ARCH="$BUILD_ARCH"
;;
x86_64|x86-64)
BUILD_CFLAGS="-march=x86-64 -mtune=core2 -O2 -fPIC"
BUILD_LIBDIRSUFFIX="64"
PKG_ARCH="x86_64"
;;
*)
echo -e "\\033[1;31m${0##*/}: $(uname -m): unsupported architecture.\\033[0;39m"; exit 1
;;
esac
PKG_STORE="/tmp/pkg-store/$BUILD_OS_ID$BUILD_LIBDIRSUFFIX-$BUILD_OS_VERSION_ID"
[[ -e ../build.options ]] && {
. ../build.options || exit 1
}
SRC_DIR="$(pwd)"
umask 0022 &&
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
mkdir -p -m 750 "$BUILD_WORKDIR" &&
mkdir -m 755 "$BUILD_ROOT" || exit 1
case "$SRCFILE_EXT" in
tar.gz|tgz) SRCFILE_DECOMP="gzip" ;;&
tar.bz|tar.bz2|tbz) SRCFILE_DECOMP="bzip2" ;;&
tar.xz|txz) SRCFILE_DECOMP="xz" ;;&
tar.lz|tlz) SRCFILE_DECOMP="lzma" ;;&
tar.*|tgz|tbz|txz|tlz) tar -xv "--$SRCFILE_DECOMP" -C "$BUILD_WORKDIR" \
-f "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
zip|ZIP) unzip -d "$BUILD_WORKDIR" "$SRC_DIR/$SRCFILE_NAME$SRCFILE_DELIM$SRCFILE_VERSION.$SRCFILE_EXT" || exit 1 ;;
*) echo -e "\\033[1;31m${0##*/}: $SRCFILE_EXT: unknown archive format.\\033[0;39m"; exit 1 ;;
esac
cd "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION" &&
chown -R root:root . &&
chmod -R go-w . || exit 1
# zcat $SRC_DIR/FIXME.patch.gz | patch -p0 || exit 1
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}" LDFLAGS="$BUILD_LDFLAGS" ./configure --prefix="$BUILD_PREFIX" \
--libdir="$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX" --sysconfdir="/etc/$PKG_NAME" --localstatedir="/var" --mandir="$BUILD_PREFIX/man" \
--infodir="$BUILD_PREFIX/info" --docdir="$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" --build="$PKG_ARCH-slackware-linux" \
--enable-shared --disable-static \
FIXME &&
make "$BUILD_MAKEFLAGS" &&
make "$BUILD_MAKEFLAGS" DESTDIR="$BUILD_ROOT" install || exit 1
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" &&
cp --parents FIXME \
"$BUILD_ROOT/$BUILD_PREFIX/doc/$PKG_NAME-$PKG_VERSION" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/rc.d" &&
# cat "$SRC_DIR/rc.FIXME" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" >"$BUILD_ROOT/etc/rc.d/rc.FIXME" &&
# chmod 755 "$BUILD_ROOT/etc/rc.d/rc.FIXME" || exit 1
# mkdir -p -m 755 "$BUILD_ROOT/etc/profile.d" &&
# for FILE in "$SRC_DIR/FIXME.{csh,sh}"; do
# cat "$FILE" | sed -e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" | sed -e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
# >"$BUILD_ROOT/etc/profile.d/${FILE##*/}" &&
# chmod 755 "$BUILD_ROOT/etc/profile.d/${FILE##*/}" || exit 1
# done
# mkdir -p -m 755 "$BUILD_ROOT/etc/logrotate.d" &&
# cat "$SRC_DIR/FIXME.logrotate" >"$BUILD_ROOT/etc/logrotate.d/FIXME" || exit 1
###############################################################################
# Nothing below this notice should be changed or removed without good reason! #
###############################################################################
HARDLINKS="$(find $BUILD_ROOT -type f -links +1)"
if [[ ! -z "$HARDLINKS" ]]; then
echo -e "\\033[1;31mFound hardlinked files:\\033[0;39m"
echo -e "\\033[1;31m$HARDLINKS\\033[0;39m"
exit 1
fi
find "$BUILD_ROOT" | xargs -r file | egrep "ELF.*(executable|shared object)" | cut -d: -f1 | xargs -r strip --strip-unneeded || exit 1
for DIR in "$BUILD_ROOT/$BUILD_PREFIX/share/man" "$BUILD_ROOT/usr/share/man" "$BUILD_ROOT/$BUILD_PREFIX/share/info" \
"$BUILD_ROOT/usr/share/info"
do
if [[ -e "$DIR" ]]; then
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
cp -aR "$DIR/"* "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" &&
rm -rf "$DIR" || exit 1
fi
done
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/man" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/man" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$" | xargs -r gzip -9 &&
find "$BUILD_ROOT/$BUILD_PREFIX/man" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo -e "\\033[1;31mDangling symlink: %p\\033[0;39m"; exit 1
fi\n' | bash -x || exit 1
fi
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/info" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/info" -regextype posix-extended -type f -regex \
"^$BUILD_ROOT/$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$" | xargs -r gzip -9 &&
rm -f "$BUILD_ROOT/$BUILD_PREFIX/info/dir" &&
find "$BUILD_ROOT/$BUILD_PREFIX/info" -type l -printf '
if [ -e "%h/%l.gz" ]; then
(cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || exit 1
else
echo -e "\\033[1;31mDangling symlink: %p\\033[0;39m"; exit 1
fi\n' | bash -x || exit 1
fi
if [[ -e "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" ]]; then
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" -name .packlist | xargs -r -I{} sed -ri {} -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/dir::g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" &&
find "$BUILD_ROOT" -name perllocal.pod | xargs -r rm || exit 1
# Note: These will fail if $BUILD_ROOT == /usr, but are required to clean up left over directories from perllocal.pod removal.
rmdir $BUILD_ROOT/usr/lib$BUILD_LIBDIRSUFFIX/perl5 # OK to fail
rmdir $BUILD_ROOT/usr/lib$BUILD_LIBDIRSUFFIX # OK to fail
rmdir $BUILD_ROOT/usr # OK to fail
fi
if [[ "$BUILD_PREFIX" =~ ^/opt/($PKG_NAME|$SRCFILE_NAME|$SRCDIR_NAME).* ]]; then
# /opt/<package> is a special case. Because the FHS requires everything to be
# contained in their own directory, make symlinks into the standard /opt dirs.
( cd "$BUILD_ROOT/opt" &&
for DIR in bin include info lib lib64 man sbin share; do
if [ -e "${BUILD_PREFIX##*/}/$DIR" ]; then
mkdir -m 755 "$DIR" &&
(cd "$DIR" && lndir -silent "../${BUILD_PREFIX##*/}/$DIR)") || exit 1
fi
done
) || exit 1
fi
mkdir -m 755 "$BUILD_ROOT/install" &&
for FILE in doinst.sh slack-{conflicts,desc,install,remove,required,suggests}; do
if [[ -e "$SRC_DIR/$FILE" ]]; then
egrep -v '^#|^$|-handy-ruler-' "$SRC_DIR/$FILE" | sed \
-e "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" \
-e "s:%BUILD_LIBDIRSUFFIX%:$BUILD_LIBDIRSUFFIX:g" \
-e "s:%BUILD_OS_ID%:$BUILD_OS_ID:g" \
-e "s:%BUILD_OS_VERSION_ID%:$BUILD_OS_VERSION_ID:g" \
-e "s:%PKG_NAME%:$PKG_NAME:g" \
-e "s:%PKG_VERSION%:$PKG_VERSION:g" \
-e "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" \
-e "s:%PKG_ARCH%:$PKG_ARCH:g" \
-e "s:%PKG_BUILD%:$PKG_BUILD:g" \
-e "s:%PKG_TAG%:${PKG_TAG//-/_}:g" \
-e "s:%PKG_EXT%:$PKG_EXT:g" \
>"$BUILD_ROOT/install/$FILE" || exit 1
fi
done
cd "$BUILD_ROOT" &&
rm -f "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}."* &&
makepkg -l y -p -c n "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" &&
cat install/slack-desc >"$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.txt" || exit 1
mkdir -p -m 755 "$PKG_STORE" &&
mv -b "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}".{"$PKG_EXT",txt} "$PKG_STORE" || exit 1
if [[ "$BUILD_NOCLEANUP" != "1" ]]; then
rm -rf "$BUILD_ROOT" "$BUILD_WORKDIR/$SRCDIR_NAME$SRCDIR_DELIM$SRCDIR_VERSION"
fi
echo -e "\\033[1;32mPackage built:\n " \
"$(ls "$PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT")\\033[0;39m"

0
templates/patches/.empty Normal file
View file

View file

128
templates/rc.d/rc.template Executable file
View file

@ -0,0 +1,128 @@
#!/bin/bash
# Version: 0.3.1
# Copyright (c) 2005-2022:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
EXEC=""
ARGS=()
PIDFILE=""
# Allow configuration in /etc/default to override.
# Additional available variables:
# ENVIRONMENT=() # Extra environment passed to $EXEC. Must be an array.
# EXTRA_ARGS=() # Extra arguments passed to $EXEC. Must be an array.
# SLAY_DELAY="" # Delay between the SIGTERM and SIGKILL on a 'stop'. Default: 2s.
# RESTART_DELAY="" # Delay between stopping and starting on a 'restart'. Default: 2s.
# shellcheck disable=SC1090
[[ -e "/etc/default/${0##*rc.}" ]] && { source "/etc/default/${0##*rc.}" || return 1 2>/dev/null || exit 1; }
error() {
printf "%s: %s: %s\\n" "${BASH_SOURCE[0]##*/}" "${EXEC##*/}" "$*" >&2
}
checkconfigured() {
# This function can be used to perform any pre-start tests; hopfully to insure the daemon
# can start correctly, before actually trying to start it. A return value of 0 means the
# tests were passed and the daemon should be started. Any other value prevents the
# daemon from being started, and an error message will be emitted.
return 0
}
checkstatus() {
# shellcheck disable=SC2155
local RUNPIDS="$({ pgrep -f "$EXEC"; pgrep -F "$PIDFILE" 2>/dev/null; } | sort -u )"
if [[ -n "$RUNPIDS" ]]; then
printf "%s: %s: %s" "${BASH_SOURCE[0]##*/}" "${EXEC##*/}" "running"
if [[ -n "$PIDFILE" ]]; then
if [[ ! -e "$PIDFILE" ]]; then
printf "%s" ", but .pid file does not exist"
elif ! grep "\<$(<"$PIDFILE")\>" <<<"$RUNPIDS" >/dev/null 2>&1; then
printf "%s" ", but .pid file is stale"
fi
fi
printf "\\n"
else
printf "%s: %s: %s\\n" "${BASH_SOURCE[0]##*/}" "${EXEC##*/}" "stopped"
return 1
fi
return 0
}
startdaemon() {
if [[ ! -e "$EXEC" ]]; then
error "not found"
return 2
elif [[ ! -x "$EXEC" ]]; then
error "not executable"
return 2
elif ! checkconfigured; then
error "not started - pre-start checks failed"
return 2
fi
# shellcheck disable=SC2048,SC2086
${ENVIRONMENT:+declare ${ENVIRONMENT[*]};} "$EXEC" ${ARGS[*]} ${EXTRA_ARGS[*]}
# shellcheck disable=SC2181
if (( $? != 0 )); then
error "error starting daemon"
return 2
else
return 0
fi
}
stopdaemon() {
kill -TERM "$(pgrep -f "$EXEC" | tr $'\n' " ")" >/dev/null 2>&1
[[ -e "$PIDFILE" ]] && {
sleep 0.5
kill -TERM "$(<"$PIDFILE")" >/dev/null 2>&1
}
sleep "${SLAY_DELAY:-2}"
checkstatus >/dev/null && {
error "failed to stop gracefully - slaying"
kill -KILL "$({ cat "$PIDFILE"; pgrep -f "$EXEC"; } 2>/dev/null | sort -u | tr $'\n' " ")" >/dev/null 2>&1
}
return 0
}
case "$1" in
'start')
if checkstatus >/dev/null; then
error "already running"
printf " %s\\n" "Try: ${BASH_SOURCE[0]} status" >&2
RET=1
else
startdaemon
RET=$?
fi
;;
'stop')
if ! checkstatus >/dev/null; then
error "not running"
printf " %s\\n" "Try: ${BASH_SOURCE[0]} status" >&2
RET=1
else
stopdaemon
RET=$?
fi
;;
'restart')
checkstatus >/dev/null
(( $? != 3 )) && {
stopdaemon >/dev/null 2>&1
sleep "${RESTART_DELAY:-2}"
}
startdaemon
RET=$?
;;
'status')
checkstatus
RET=$?
;;
*)
printf "%s\\n" "Usage: ${BASH_SOURCE[0]} <start|stop|restart|status>" >&2
RET=1
;;
esac
return $RET 2>/dev/null || exit $RET

View file

@ -0,0 +1,6 @@
# Version: 0.2.2
# This is the list of packages which, if installed, will conflict with the
# package currently being installed. For example, 'lprng' conflicts with
# 'cups' as they are both printing systems.
# Packages must be listed one per line and are case sensitive. No versioning
# information should be used. This file is only used by slapt-get.

19
templates/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# Version: 0.2.3
# Package description syntax:
# * There must be exactly 11 lines which begin with the package name and ':'.
# * Line up the first '|' of the ruler with the ':' following the package name.
# * A single space should be left after the ':' before any description text.
# * The end '|' of the ruler marks the last columm which should contain text.
|-----handy-ruler------------------------------------------------------|
%PKG_NAME%: FIXME (FIXME)
%PKG_NAME%:
%PKG_NAME%:
%PKG_NAME%:
%PKG_NAME%:
%PKG_NAME%:
%PKG_NAME%:
%PKG_NAME%:
%PKG_NAME%: Warning: This package does not contain any configuration files.
%PKG_NAME%:
%PKG_NAME%: Packaged by: Darren 'Tadgy' Austin. Built for: %DIST_OS_ID%%BUILD_LIBDIRSUFFIX%-%DIST_OS_VERSION_ID%.

12
templates/slack-requires Normal file
View file

@ -0,0 +1,12 @@
# Version: 0.2.3
# This is the list of packages which, if the package currently being installed
# is to operate correctly, must be installed on the system - its dependancies.
# For example, 'spamassassin' requires the 'perl' package to operate.
# Packages must be listed one per line and are case sensitive. If multiple
# packages could satisfy a single dependancy (such as 'openssl-solibs' and
# 'openssl' for the SSL library) the packages should be listed in the format:
# <pkg1> | <pkg2> [| <pkg3> ...]
# Specific package versions can be specified using = >= =< < > operators.
# The = operator requires the full package version string (eg, 1.2.3-x86_64-5).
# The >= =< < > operators, can use the short package version string
# (eg, 1.2.3) or the full version string. This file is only used by slapt-get.

10
templates/slack-suggests Normal file
View file

@ -0,0 +1,10 @@
# Version: 0.2.2.
# This is a list of packages which, if installed, would provide extra features
# or functionality to the currently installing package. For example, the
# 'httpd' web server package can be enhanced by installing the 'php' package.
# Packages must be listed one per line and are case sensitive. If multiple
# packages can satisfy a single suggestion (such as 'openssl-solibs' and
# 'openssl' for the SSL library), the packages should be listed in the format:
# <pkg1> | <pkg2> [| <pkg3> ...]
# No versioning information should be used. This file is only used by
# slapt-get.

321
templates/template.SlackBuild Executable file
View file

@ -0,0 +1,321 @@
#!/bin/bash
# Version: 0.6.0
# Copyright (c) 2005-2022:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
########################################################################
# None of this section requires editing. #
# Scroll down to the "Begin section that will require editing" marker. #
########################################################################
# Silence shellcheck.
# shellcheck disable=SC2015,SC2174
# Functions.
check_installed() {
# $1 = The package name to check is installed.
[[ -z "$1" ]] && return 1
printf "%s\\n" /var/lib/pkgtools/packages/* | grep -P "^/var/lib/pkgtools/packages/\Q$1\E-([^-]*)-([^-]*)-([^-]*)$" >/dev/null 2>&1
return $?
}
die() {
# $1 = The message to write to stderr on exit.
printf "\\033[1;31m$%s: %s\\033[0;39m\\n" "${0##*/}" "${1:-Abort}" >&2
exit 1
}
# Make sure to be in the build directory.
# shellcheck disable=SC2164
cd "$(cd "${BASH_SOURCE[0]%/*}"; pwd -P)"
# Read global buildconf settings.
# shellcheck disable=SC1091
[[ -e ../buildconf ]] && {
. ../buildconf || die "Error sourcing global buildconf"
}
# Package specific buildconf settings.
# shellcheck disable=SC2015,SC1090
[[ -e "./$(basename "${BASH_SOURCE[0]}" .SlackBuild).buildconf" ]] && . "./$(basename "${BASH_SOURCE[0]}" .SlackBuild).buildconf" || \
die "Error sourcing package buildconf"
# Package storage path.
# Be safe and leave it in /tmp by default (can be overridden).
# shellcheck disable=SC2016
PKG_STORE='${PKG_STORE:-/tmp/pkg-store/$DIST_OS_ID$BUILD_LIBDIRSUFFIX-$DIST_OS_VERSION_ID}'
# Parse command line options.
while [[ $# -gt 0 ]]; do
if [[ "$1" =~ ^-(-)?f(orce)?$ ]]; then
BUILD_FORCE=1
elif [[ "$1" =~ ^-(-)?n(o-cleanup)?$ ]]; then
BUILD_CLEANUP=0
elif [[ "$1" =~ ^-(-)?v(ersion)?$ ]]; then
printf "%s=\"%s\"\\n" "NAME" "$PKG_NAME"
printf "%s=\"%s\"\\n" "VERSION" "$PKG_VERSION"
printf "%s=\"%s\"\\n" "BUILD" "$PKG_BUILD$PKG_TAG"
exit 0
else
printf "%s: %s: %s\\n" "${0##*/}" "Invalid option" "$1" >&2
printf "%s: %s %s\\n" "Usage" "${0##*/}" "[[-f|--force]|[-n|--no-cleanup]|[-v|--version]]" >&2
exit 1
fi
shift
done
# Pre-build checks.
if (( ${BUILD_FORCE:-0} != 1 )); then
printf "%s\\n" "${BUILD_CONFLICTS[@]}" | while read -r PKG; do
check_installed "$PKG" && die "Conflicting package installed: $PKG"
done
printf "%s\\n" "${BUILD_REQUIRES[@]}" | while read -r PKG; do
check_installed "$PKG" || die "Required package not installed: $PKG"
done
fi
# Gather some system information.
# shellcheck disable=SC2046
declare DIST_OS_$(grep "^ID=" /etc/os-release)
# shellcheck disable=SC2046
declare DIST_OS_$(grep "^VERSION_ID=" /etc/os-release)
# Try to detect a 'current' build environment.
# shellcheck disable=SC2046
declare DIST_OS_$(grep "^VERSION_CODENAME=" /etc/os-release)
[[ "$DIST_OS_VERSION_CODENAME" == "current" ]] && DIST_OS_VERSION_ID="current"
unset DIST_OS_VERSION_CODENAME
# Build environment.
BUILD_WORKDIR="${BUILD_WORKDIR:-/tmp/pkg-build}"
BUILD_ROOT="$BUILD_WORKDIR/pkg-$PKG_NAME"
BUILD_PREFIX="${BUILD_PREFIX:-/opt}"
BUILD_NUMJOBS="${BUILD_NUMJOBS:-7}"
case "${BUILD_ARCH:=$(uname -m)}" in
i[45]86)
BUILD_CFLAGS="${BUILD_CFLAGS:--march="$BUILD_ARCH" -mtune=i586 -O2}"
BUILD_CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}"
BUILD_LDFLAGS="${BUILD_LDFLAGS:-}"
BUILD_MAKEFLAGS=( "${BUILD_MAKEFLAGS[@]}" )
PKG_ARCH="${PKG_ARCH:-$BUILD_ARCH}"
;;
i686)
BUILD_CFLAGS="${BUILD_CFLAGS:--march="$BUILD_ARCH" -mtune=pentium4 -O2}"
BUILD_CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}"
BUILD_LDFLAGS="${BUILD_LDFLAGS:-}"
BUILD_MAKEFLAGS=( "${BUILD_MAKEFLAGS[@]}" )
PKG_ARCH="${PKG_ARCH:-$BUILD_ARCH}"
;;
x86_64|x86-64)
BUILD_CFLAGS="${BUILD_CFLAGS:--march=x86-64-v2 -mtune=ivybridge -O2 -fPIC}"
BUILD_CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}"
BUILD_LDFLAGS="${BUILD_LDFLAGS:-}"
BUILD_MAKEFLAGS=( "${BUILD_MAKEFLAGS[@]}" )
BUILD_LIBDIRSUFFIX="64"
PKG_ARCH="${PKG_ARCH:-x86_64}"
;;
aarch64)
BUILD_CFLAGS="${BUILD_CFLAGS:-O2 -fPIC}"
BUILD_CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}"
BUILD_LDFLAGS="${BUILD_LDFLAGS:-}"
BUILD_MAKEFLAGS=( "${BUILD_MAKEFLAGS[@]}" )
BUILD_LIBDIRSUFFIX="64"
PKG_ARCH="${PKG_ARCH:-aarch64}"
DIST_OS_VERSION_ID="slackwareaarch"
;;
arm*)
BUILD_CFLAGS="${BUILD_CFLAGS:-O2}"
BUILD_CXXFLAGS="${BUILD_CXXFLAGS:-$BUILD_CFLAGS}"
BUILD_LDFLAGS="${BUILD_LDFLAGS:-}"
BUILD_MAKEFLAGS=( "${BUILD_MAKEFLAGS[@]}" )
PKG_ARCH="${PKG_ARCH:-arm}"
DIST_OS_VERSION_ID="slackwarearm"
;;
*)
die "Unsupported build architecture: $BUILD_ARCH"
;;
esac
# Now all possible changes to variables in PKG_STORE are complete, expand out the embedded variables.
eval "$(declare -p PKG_STORE | sed -re 's/\\\$/$/g')"
# Sanity.
SRC_DIR="$(pwd)"
umask 0022
[[ ! -e "$BUILD_WORKDIR" ]] || mkdir -p -m 750 "$BUILD_WORKDIR" || die "Failed to create working directory"
rm -rf "$BUILD_ROOT" && mkdir -m 755 "$BUILD_ROOT" || die "Failed to clear build root"
rm -rf "${SRC_DIRNAMES[@]/#/$BUILD_WORKDIR/}" || die "Failed to clear source directories"
# Get sources if they aren't downloaded already.
WGET="$(command -v wget)"
I=0
printf "%s\\n" "${SRC_DOWNLOADS[@]}" | while read -r SRC; do
[[ ! -e "${SRC_FILENAMES[$I]}" ]] && {
[[ -z "$WGET" ]] && die "wget is required to download sources"
"$WGET" -t 3 -c -T 30 --waitretry=5 --retry-connrefused --retry-on-host-error --no-check-certificate --passive-ftp -O "${SRC_FILENAMES[$I]}" "$SRC" ||\
die "Failed to download source file: $SRC"
}
[[ "$(md5sum "${SRC_FILENAMES[$I]}" | cut -d' ' -f1)" != "${SRC_MD5SUMS[$I]}" ]] && die "md5sum verification failed: ${SRC_FILENAMES[$I]}"
(( I++ ))
done
# Unpack sources.
printf "%s\\n" "${SRC_FILENAMES[@]}" | while read -r SRC; do
case "$SRC" in
*.tar.?z|*.t?z)
tar -xv -C "$BUILD_WORKDIR" -f "$SRC" || die "Failed to extract source: $SRC"
;;
*.zip|*.ZIP)
unzip -d "$BUILD_WORKDIR" "$SRC" || die "Failed to extract source: $SRC"
;;
*)
die "Un-handled source archive format: ${SRC##*.}"
;;
esac
done
# Fix any weird permissions on sources.
chown -R root:root "${SRC_DIRNAMES[@]/#/$BUILD_WORKDIR/}" && chmod -R go-w "${SRC_DIRNAMES[@]/#/$BUILD_WORKDIR/}" || \
die "Failed to correct source directory permissions"
# Standard ./configure options.
CONFIGURE_OPTS=("--prefix=\"$BUILD_PREFIX\"" "--libdir=\"$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX\"" "--sysconfdir=\"/etc/$PKG_NAME\"" "--localstatedir=/var"
"--mandir=\"$BUILD_PREFIX/man\"" "--infodir=\"$BUILD_PREFIX/info\"" "--build=\"$PKG_ARCH-slackware-linux\"" "--enable-shared" "--disable-static")
# Process each of the sources.
for ((I = 0; I < ${#SRC_DIRNAMES[@]}; I++)); do
# Be in the source directory.
cd "$BUILD_WORKDIR/${SRC_DIRNAMES[$I]}" || die "Failed to change to source directory: $BUILD_WORKDIR/${SRC_DIRNAMES[$I]}"
############################################
# Begin section that will require editing. #
############################################
# Build each source in the array.
case "$I" in
0)
# Patch before build.
# zcat $SRC_DIR/patches/EDITME.diff.gz | patch -p0 || die "Source patching failed on: EDITME.diff.gz"
# Configure.
CFLAGS="$BUILD_CFLAGS" CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" ./configure "${CONFIGURE_OPTS[@]}" \
--docdir="$BUILD_PREFIX/doc/${SRC_FILENAMES[$I]%%.*}" EDITME || \
die "Source ./configure failed: ${SRC_DIRNAMES[$I]}"
# Build and install.
make -j "BUILD_NUMJOBS" "${BUILD_MAKEFLAGS[@]}" && make -j "BUILD_NUMJOBS" "${BUILD_MAKEFLAGS[@]}" DESTDIR="$BUILD_ROOT" install || \
die "Failed to build and install source: ${SRC_DIRNAMES[$I]}"
# Package documentation.
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/doc/${SRC_FILENAMES[$I]%%.*}" && cp --parents EDITME \
"$BUILD_ROOT/$BUILD_PREFIX/doc/${SRC_FILENAMES[$I]%%.*}" || die "Documentation copy failed: ${SRC_DIRNAMES[$I]}"
;;
*)
die "Un-handled source file - no build configuration"
;;
esac
done
##################################################
# End of the only section that required editing. #
##################################################
# Set up for sed replacements.
SED_OPTS=("-e" "s:%BUILD_PREFIX%:$BUILD_PREFIX:g" "-e" "s:%BUILD_LIBDIR%:$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX:g" "-e" "s:%BUILD_ARCH%:$BUILD_ARCH:g"
"-e" "s:%DIST_OS_ID%:$DIST_OS_ID:g" "-e" "s:%DIST_OS_VERSION_ID%:$DIST_OS_VERSION_ID:g" "-e" "s:%PKG_NAME%:$PKG_NAME:g"
"-e" "s:%PKG_VERSION%:$PKG_VERSION:g" "-e" "s:%PKG_FILE_VERSION%:${PKG_VERSION//-/_}:g" "-e" "s:%PKG_ARCH%:$PKG_ARCH:g"
"-e" "s:%PKG_BUILD%:$PKG_BUILD:g" "-e" "s:%PKG_TAG%:${PKG_TAG//-/_}:g" "-e" "s:%PKG_EXT%:$PKG_EXT:g")
# Add extra configuration/scripts.
for DIR in cron.d cron.hourly cron.daily cron.weekly cron.monthly default logrotate.d profile.d rc.d; do
[[ -e "$SRC_DIR/$DIR" ]] && {
mkdir -p -m 755 "$BUILD_ROOT/etc/$DIR" || die "Failed to create directory: /etc/$DIR"
for FILE in "$SRC_DIR/$DIR"/*; do
sed -r "${SED_OPTS[@]}" <"$FILE" >"$BUILD_ROOT/etc/$DIR/${FILE##*/}" && chmod --reference="$FILE" "$BUILD_ROOT/etc/$DIR/${FILE##*/}" || \
die "Failed to copy $DIR/${FILE##*/} into package"
done
}
done
# Slackware packages don't ship with hardlinks (I don't know why...).
HARDLINKS="$(find "$BUILD_ROOT" -type f -links +1 | tr $'\n' ' ')"
[[ -n "$HARDLINKS" ]] && die "Found hardlinked files in package: $HARDLINKS"
# Strip binaries.
find "$BUILD_ROOT" -type f -exec file {} + | grep -E "ELF.*(executable|shared object)" | cut -d: -f1 | xargs -r strip --strip-unneeded || \
die "Failed to stip object files"
# Move man and info pages if required.
for DIR in "$BUILD_ROOT/$BUILD_PREFIX/share/man" "$BUILD_ROOT/usr/share/man" "$BUILD_ROOT/$BUILD_PREFIX/share/info" "$BUILD_ROOT/usr/share/info"; do
[[ -e "$DIR" ]] && {
mkdir -p -m 755 "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" || die "Failed to create $BUILD_PREFIX/${DIR##*/} directory"
mv "$DIR"/* "$BUILD_ROOT/$BUILD_PREFIX/${DIR##*/}" && rmdir "$DIR" || die "Failed to move $DIR to correct directory"
}
done
# Handle man pages.
[[ -e "$BUILD_ROOT/$BUILD_PREFIX/man" ]] && {
find "$BUILD_ROOT/$BUILD_PREFIX/man" -regextype posix-extended -type f -regex "^$BUILD_ROOT/$BUILD_PREFIX/man/([^/]*/)?man.*/.*\.[[:digit:]n]{1}[^.]*$" \
-exec gzip -9 {} + || die "Failed to compress man pages"
find "$BUILD_ROOT/$BUILD_PREFIX/man" -type l -printf 'if [[ -e "%h/%l.gz" ]]; then (cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || \
die "Failed to fix symlink: %f"; else die "Dangling symlink: %p"; fi\n' | bash || die "Man pages' symlinks correction failed"
}
# Compress and fix info pages.
[[ -e "$BUILD_ROOT/$BUILD_PREFIX/info" ]] && {
rm -f "$BUILD_ROOT/$BUILD_PREFIX/info/dir"
find "$BUILD_ROOT/$BUILD_PREFIX/info" -regextype posix-extended -type f -regex "^$BUILD_ROOT/$BUILD_PREFIX/info/.*(\.info){1}(-[[:digit:]]+)?$" \
-exec gzip -9 {} + || die "Failed to compress info pages"
find "$BUILD_ROOT/$BUILD_PREFIX/info" -type l -printf 'if [[ -e "%h/%l.gz" ]]; then (cd "%h" && ln -sf "%l.gz" "%f.gz" && rm -f "%f") || \
die "Failed to fix symlink: %f"; else die "Dangling symlink: %p"; fi\n' | bash || die "Info pages' symlink correction failed"
}
# Fix paths for perl modules.
[[ -e "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" ]] && {
find "$BUILD_ROOT/$BUILD_PREFIX/lib$BUILD_LIBDIRSUFFIX/perl5" -name .packlist -exec sed -ri -e "s:^$BUILD_ROOT::g" \
-e "s:^($BUILD_PREFIX|/usr){1}/share:$BUILD_PREFIX:g" \
-e "s:^$BUILD_PREFIX/man/([^/]*/)?(man.*)/(.*)\.([[:digit:]n]){1}([^.])*$:$BUILD_PREFIX/man/\1\2/\3\.\4\5\.gz:g" \
-e "s:^$BUILD_PREFIX/info/(.*)(\.info){1}(-[[:digit:]]+)?$:$BUILD_PREFIX/info/\1\2\3.gz:g" {} + || die "Failed to modify incorrect perl paths"
find "$BUILD_ROOT" -name perllocal.pod -exec rm -f {} + # Should never fail
# Note: These will fail if $BUILD_ROOT == /usr, but are required to clean left over directories from perllocal.pod removal.
rmdir "$BUILD_ROOT/usr/lib$BUILD_LIBDIRSUFFIX/perl5" 2>/dev/null # OK to fail
rmdir "$BUILD_ROOT/usr/lib$BUILD_LIBDIRSUFFIX" 2>/dev/null # OK to fail
rmdir "$BUILD_ROOT/usr" 2>/dev/null # OK to fail
}
# /opt/<package>{,-<version>} is a special case.
# Technically, the FHS requires everything in /opt to be contained in its own package directory,
# so - assuming this technicallity is in use - make symlinks into the standard /opt dirs.
[[ "$BUILD_PREFIX" =~ ^/opt/$PKG_NAME.* ]] && {
(cd "$BUILD_ROOT/opt" &&
for DIR in bin doc include info lib lib64 libexec man sbin share; do
[[ -e "${BUILD_PREFIX##*/}/$DIR" ]] && { mkdir -m 755 "$DIR" && (cd "$DIR" && lndir -silent "../${BUILD_PREFIX##*/}/$DIR)") || exit 1; }
done) || die "Failed to link /opt paths"
}
# Copy pkgtool special files into the package.
mkdir -m 755 "$BUILD_ROOT/install" || die "Failed to make /install directory"
for FILE in doinst.sh slack-{conflicts,desc,required,suggests}; do
[[ -e "$SRC_DIR/$FILE" ]] && {
sed -r -e '/(^#|^$|-handy-ruler-)/ d' "${SED_OPTS[@]}" <"$SRC_DIR/$FILE" >"$BUILD_ROOT/install/$FILE" || \
die "Failed to copy in pkgtool special file: $FILE"
}
done
# Build the package.
cd "$BUILD_ROOT" || die "Failed to cd to BUILD_ROOT to build package"
rm -f "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}".*
makepkg -l y -p -c n --acls --xattrs "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" || \
die "Package creation failed"
# Move package to the store.
mkdir -p -m 755 "$PKG_STORE" &&
mv --backup=numbered "$BUILD_WORKDIR/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT" "$PKG_STORE" || \
die "Failed to move package to store"
# Clean up after ourselves.
(( ${BUILD_CLEANUP:-1} == 1 )) && rm -rf "$BUILD_ROOT" "${SRC_DIRNAMES[@]/#/$BUILD_WORKDIR/}"
printf "\\033[1;32m%s:\\n %s\\033[0;39m\\n" "Package built" "$PKG_STORE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}.$PKG_EXT"

View file

@ -0,0 +1,16 @@
# Package details.
PKG_NAME="$(basename "${BASH_SOURCE[0]}" .buildconf)"
PKG_VERSION=""
PKG_BUILD="1"
PKG_TAG="${PKG_TAG:-_tadgy}"
PKG_EXT="${PKG_EXT:-txz}"
# Sources - the details in these arrays must all match per indicies.
SRC_DOWNLOADS=("https://.../$PKG_NAME-$PKG_VERSION.tar.xz")
SRC_MD5SUMS=("")
SRC_FILENAMES=("$PKG_NAME-$PKG_VERSION.tar.xz")
SRC_DIRNAMES=("$PKG_NAME-$PKG_VERSION")
# Build configuration.
BUILD_REQUIRES=()
BUILD_CONFLICTS=("$PKG_NAME")