#!/bin/sh -e # A hacky script to generate .t?z files using satellites. # It's a fairly simple wrapper to astronaut, that generates a pkgtools package at the end. # This may also serve as an example on how you can wrap astronaut to package in any format. _fakeroot="$(command -v fakeroot || true)" [ "$_fakeroot" ] && _fakeroot='fakeroot' if [ ! "$_fakeroot" -a "$(id -u)" != "0" ]; then echo 'This script has to be run as root, or you need fakeroot installed.' 1>&2 exit 1 fi _topdir=$PWD _astronaut="$(dirname "$0")/astronaut" [ ! -f "$_astronaut" ] && _astronaut='astronaut' _astronaut_nuke_dir_install=true . "$_astronaut" # Gzip man and info pages if [ -d "$dir_install/$dir_prefix/$dir_mandir" ]; then find "$dir_install/$dir_prefix/$dir_mandir" -type f -exec gzip -9 {} \; for i in $(find "$dir_install/$dir_prefix/$dir_mandir" -type l); do ln -s "$(readlink "$i").gz" "$i.gz"; rm "$i"; done fi if [ -d "$dir_install/$dir_prefix/$dir_infodir" ]; then rm -f "$dir_install/$dir_prefix/$dir_infodir/dir" gzip -9 -r "$dir_install/$dir_prefix/$dir_infodir" fi # Strip binaries find "$dir_install" | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null | true # Generate slack-desc for proper compliance, even if it's completely redundant #mkdir -p "$dir_install/install" #cat > "$dir_install/install/slack-desc" << EOF ## HOW TO EDIT THIS FILE: ## The "handy ruler" below makes it easier to edit a package description. Line ## up the first '|' above the ':' following the base package name, and the '|' ## on the right side marks the last column you can put a character in. You must ## make exactly 11 lines for the formatting to be correct. It's also ## customary to leave one space after the ':'. #$(printf %$(printf '%s' "$_satname" | wc -c)s)|-----handy-ruler------------------------------------------------------| #$_satname: $_satname (Generated with astronautpkg) #$_satname: #$_satname: #$_satname: #$_satname: #$_satname: #$_satname: #$_satname: #$_satname: #$_satname: #$_satname: #EOF # dir_wrapper_pkgtools should be set from a configuration file (e.g. ~/.astronaut.conf), and points to wherever you want your packages to be placed. [ "$dir_wrapper_pkgtools" ] && mkdir -p "$dir_wrapper_pkgtools" || dir_wrapper_pkgtools="$_topdir" cd "$dir_install" PATH="$PATH:/sbin" $_fakeroot makepkg -l y -c n "$dir_wrapper_pkgtools/$_satname-$(echo "$version" | sed -e 's/-/_/g')-$(uname -m)-astro.txz"