Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd-or-msg
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh

srcdir=`dirname $0`
srcdir=$(dirname "$0")
opt="$1"
shift

echo "$*"
if ! "${@}"; then
echo "If you can't fix the issue, re-run $srcdir/configure with --$opt."
echo "If you can't fix the issue, re-run ${srcdir}/configure with --${opt}."
exit 1
fi
8 changes: 4 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# if not, it tries to fetch rsync's generated files or build them. We
# then transfer control to the configure.sh script to do the real work.

dir=`dirname $0`
if test x"$dir" = x; then
dir=$(dirname "$0")
if test "$dir" = ""; then
dir=.
fi

if test "$dir" = '.'; then
branch=`packaging/prep-auto-dir` || exit 1
if test x"$branch" != x; then
branch=$(packaging/prep-auto-dir) || exit 1
if test "$branch" != ""; then
cd build || exit 1
dir=..
fi
Expand Down
75 changes: 38 additions & 37 deletions install-sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# shellcheck disable=2086


# set DOITPROG to echo to test this script
Expand All @@ -30,7 +31,7 @@ rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"

transformbasename=""
transform_arg=""
transformarg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
Expand All @@ -42,7 +43,7 @@ src=""
dst=""
dir_arg=""

while [ x"$1" != x ]; do
while [ "$1" != "" ]; do
case $1 in
-c) instcmd="$cpprog"
shift
Expand Down Expand Up @@ -71,15 +72,15 @@ while [ x"$1" != x ]; do
shift
continue;;

-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-t=*) transformarg=$(echo "$1" | sed 's/-t=//')
shift
continue;;

-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-b=*) transformbasename=$(echo "$1" | sed 's/-b=//')
shift
continue;;

*) if [ x"$src" = x ]
*) if [ "$src" = "" ]
then
src=$1
else
Expand All @@ -92,38 +93,38 @@ while [ x"$1" != x ]; do
esac
done

if [ x"$src" = x ]
if [ "$src" = "" ]
then
echo "install: no input file specified"
exit 1
else
true
fi

if [ x"$dir_arg" != x ]; then
dst=$src
if [ "$dir_arg" != "" ]; then
dst="$src"
src=""

if [ -d $dst ]; then
instcmd=:
if [ -d "$dst" ]; then
instcmd=":"
else
instcmd=mkdir
instcmd="mkdir"
fi
else

# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.

if [ -f $src ] || [ -d $src ]
if [ -f "$src" ] || [ -d "$src" ]
then
true
else
echo "install: $src does not exist"
exit 1
fi

if [ x"$dst" = x ]
if [ "$dst" = "" ]
then
echo "install: no destination specified"
exit 1
Expand All @@ -134,16 +135,16 @@ else
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic

if [ -d $dst ]
if [ -d "$dst" ]
then
dst="$dst"/`basename $src`
dst="$dst"/$(basename "$src")
else
true
fi
fi

## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
dstdir=$(echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,')

# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
Expand All @@ -157,7 +158,8 @@ IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
# shellcheck disable=2046
set - $(echo "${dstdir}" | sed -e 's@/@%@g' -e 's@^%@/@')
IFS="${oIFS}"

pathcomp=''
Expand All @@ -177,31 +179,30 @@ while [ $# -ne 0 ] ; do
done
fi

if [ x"$dir_arg" != x ]
if [ "$dir_arg" != "" ]
then
$doit $instcmd $dst &&
$doit $instcmd "$dst" &&

if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
if [ "$chowncmd" != "" ]; then $doit $chowncmd "$dst"; else true ; fi &&
if [ "$chgrpcmd" != "" ]; then $doit $chgrpcmd "$dst"; else true ; fi &&
if [ "$stripcmd" != "" ]; then $doit $stripcmd "$dst"; else true ; fi &&
if [ "$chmodcmd" != "" ]; then $doit $chmodcmd "$dst"; else true ; fi
else

# If we're going to rename the final executable, determine the name now.

if [ x"$transformarg" = x ]
if [ "$transformarg" = "" ]
then
dstfile=`basename $dst`
dstfile=$(basename "$dst")
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
dstfile=$(basename "$dst" "$transformbasename" | sed "$transformarg")"$transformbasename"
fi

# don't allow the sed command to completely eliminate the filename

if [ x"$dstfile" = x ]
if [ "$dstfile" = "" ]
then
dstfile=`basename $dst`
dstfile=$(basename "$dst")
else
true
fi
Expand All @@ -212,25 +213,25 @@ else

# Move or copy the file name to the temp name

$doit $instcmd $src $dsttmp &&
$doit $instcmd "$src" "$dsttmp" &&

trap "rm -f ${dsttmp}" 0 &&
trap 'rm -f "${dsttmp}"' 0 &&

# and set any options; do chmod last to preserve setuid bits

# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.

if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
if [ "$chowncmd" != "" ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
if [ "$chgrpcmd" != "" ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
if [ "$stripcmd" != "" ]; then $doit $stripcmd "$dsttmp"; else true;fi &&
if [ "$chmodcmd" != "" ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&

# Now rename the file to the real destination.

$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
$doit $rmcmd -f "$dstdir"/"$dstfile" &&
$doit $mvcmd "$dsttmp" "$dstdir"/"$dstfile"

fi &&

Expand Down
6 changes: 3 additions & 3 deletions maybe-make-man
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ if [ $# != 1 ]; then
fi

inname="$1"
srcdir=`dirname "$0"`
srcdir=$(dirname "$0")
flagfile="$srcdir/.md2man-works"
force_flagfile="$srcdir/.md2man-force"

if [ ! -f "$flagfile" ]; then
# We test our smallest manpage just to see if the python setup works.
if "$srcdir/md-convert" --test "$srcdir/rsync-ssl.1.md" >/dev/null 2>&1; then
touch $flagfile
touch "$flagfile"
else
outname=`basename "$inname" .md`
outname=$(basename "$inname" .md)
if [ -f "$outname" ]; then
exit 0
elif [ -f "$srcdir/$outname" ]; then
Expand Down
6 changes: 3 additions & 3 deletions mkgitver
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

srcdir=`dirname $0`
srcdir=$(dirname "$0")

if [ ! -f git-version.h ]; then
touch git-version.h
Expand All @@ -15,10 +15,10 @@ if test -d "$srcdir/.git" || test -f "$srcdir/.git"; then
# clone. A release tarball has no .git, so git-version.h stays empty and
# rsync prints the plain RSYNC_VERSION.
# cd into the subshell rather than "git -C" (avoids needing a newer git).
gitsha=`(cd "$srcdir" && git rev-parse --short=8 HEAD) 2>/dev/null`
gitsha=$(cd "$srcdir" && git rev-parse --short=8 HEAD 2>/dev/null)
# Tolerate any preprocessor spacing and a trailing comment; capture only the
# quoted value. Empty (define missing/unmatched) -> leave RSYNC_GITVER unset.
rsyncver=`sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*RSYNC_VERSION[[:space:]][[:space:]]*"\([^"]*\)".*/\1/p' "$srcdir/version.h"`
rsyncver=$(sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*RSYNC_VERSION[[:space:]][[:space:]]*"\([^"]*\)".*/\1/p' "$srcdir/version.h")
if [ -n "$gitsha" ] && [ -n "$rsyncver" ]; then
gitver="$rsyncver-g$gitsha"
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
Expand Down
6 changes: 3 additions & 3 deletions packaging/prep-auto-dir
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

auto_top='auto-build-save'
if test -d $auto_top && test -d .git; then
desired_branch=`git rev-parse --abbrev-ref HEAD | tr / %`
desired_branch=$(git rev-parse --abbrev-ref HEAD | tr / %)
if test "$desired_branch" = HEAD; then
echo "ERROR: switch to the right build dir manually when in detached HEAD mode." 1>&2
exit 1
fi
auto_dir="$auto_top/$desired_branch"
if test -d build; then
cur_branch=`readlink build/.branch`
cur_branch=$(readlink build/.branch)
else
cur_branch='/'
fi
Expand All @@ -39,5 +39,5 @@ if test -d $auto_top && test -d .git; then
rm -f Makefile
ln -s packaging/auto-Makefile Makefile
fi
echo $desired_branch
echo "$desired_branch"
fi
6 changes: 3 additions & 3 deletions packaging/smart-make
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e

export LANG=C

branch=`packaging/prep-auto-dir`
if test x"$branch" = x; then
branch=$(packaging/prep-auto-dir)
if test "$branch" = ""; then
srcdir=.
else
cd build
Expand Down Expand Up @@ -40,6 +40,6 @@ fi

make all

if test x"$1" = x"check"; then
if test "$1" = "check"; then
make check
fi
47 changes: 23 additions & 24 deletions packaging/solaris/build_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@ PKGNAME=SMBrsync
# but for now it is hard coded
BASEDIR=/usr/local
VERSION="2.5.5"
ARCH=`uname -p`
ARCH=$(uname -p)
NAME=rsync

# Definitions end here
# Please do not edit below this line or you know what you do.

## Start by faking root install
echo "Creating install directory (fake $BASEDIR)..."
START=`pwd`
FAKE_ROOT=$START/${PKGNAME}
mkdir $FAKE_ROOT
START=$(pwd)
FAKE_ROOT="$START"/"${PKGNAME}"
mkdir "$FAKE_ROOT"

# copy the binary and the man page to their places
mkdir $FAKE_ROOT/bin
mkdir -p $FAKE_ROOT/doc/rsync
mkdir -p $FAKE_ROOT/man/man1
mkdir -p $FAKE_ROOT/man/man5
mkdir "$FAKE_ROOT"/bin
mkdir -p "$FAKE_ROOT"/doc/rsync
mkdir -p "$FAKE_ROOT"/man/man1
mkdir -p "$FAKE_ROOT"/man/man5

cp ../../../rsync $FAKE_ROOT/bin/rsync
cp ../../../rsync.1 $FAKE_ROOT/man/man1/rsync.1
cp ../../../rsyncd.conf.5 $FAKE_ROOT/man/man5/rsyncd.conf.5
cp ../../../README.md $FAKE_ROOT/doc/rsync/README.md
cp ../../../COPYING $FAKE_ROOT/doc/rsync/COPYING
cp ../../../tech_report.pdf $FAKE_ROOT/doc/rsync/tech_report.pdf
cp ../../../COPYING $FAKE_ROOT/COPYING
cp ../../../rsync "$FAKE_ROOT"/bin/rsync
cp ../../../rsync.1 "$FAKE_ROOT"/man/man1/rsync.1
cp ../../../rsyncd.conf.5 "$FAKE_ROOT"/man/man5/rsyncd.conf.5
cp ../../../README.md "$FAKE_ROOT"/doc/rsync/README.md
cp ../../../COPYING "$FAKE_ROOT"/doc/rsync/COPYING
cp ../../../tech_report.pdf "$FAKE_ROOT"/doc/rsync/tech_report.pdf
cp ../../../COPYING "$FAKE_ROOT"/COPYING

## Build info file
echo "Building pkginfo file..."
cat > $FAKE_ROOT/pkginfo << EOF_INFO
cat > "$FAKE_ROOT"/pkginfo << EOF_INFO
PKG=$PKGNAME
NAME=$NAME
DESC="Program for efficient remote updates of files."
Expand All @@ -61,7 +61,7 @@ CLASSES=none
EOF_INFO

## Build prototype file
cat > $FAKE_ROOT/prototype << EOFPROTO
cat > "$FAKE_ROOT"/prototype << EOFPROTO
i copyright=COPYING
i pkginfo=pkginfo
d none bin 0755 bin bin
Expand All @@ -81,14 +81,13 @@ EOFPROTO
## And now build the package.
OUTPUTFILE=$PKGNAME-$VERSION-sol8-$ARCH-local.pkg
echo "Building package.."
echo FAKE_ROOT = $FAKE_ROOT
cd $FAKE_ROOT
echo "FAKE_ROOT = $FAKE_ROOT"
cd "$FAKE_ROOT" || exit
pkgmk -d . -r . -f ./prototype -o
pkgtrans -os . $OUTPUTFILE $PKGNAME
pkgtrans -os . "$OUTPUTFILE" "$PKGNAME"

mv $OUTPUTFILE ..
cd ..
mv "$OUTPUTFILE" ..
cd .. || exit

# Comment this out if you want to see, which file structure has been created
rm -rf $FAKE_ROOT

rm -rf "$FAKE_ROOT"
Loading
Loading