[go: up one dir, main page]

File: create-lw-file

package info (click to toggle)
lordsawar 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 37,964 kB
  • ctags: 10,636
  • sloc: cpp: 91,045; sh: 4,737; xml: 2,142; makefile: 1,325
file content (26 lines) | stat: -rwxr-xr-x 834 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

# put the files given on the command line into a tarball with the same name as the first file in that list.  that first file gets overwritten.
files=$*
tmpdir=`mktemp -q -d /tmp/lw-tar.XXXXXX `
# -q is quiet and -d is --directory.
# short options are used here for portability purposes on systems that don't
# see the benefit of the explanatory power of long options.
file=`basename $1`
if [ "x$tmpdir" != "x" ]; then
  cp $files $tmpdir
  tarball=$file.tar
  origdir=`pwd`
  cd $tmpdir
  tmpfiles=""
  for f in $files; do
          tmpfiles="$tmpfiles `basename $f`"
  done
  tar -cvf $tarball $tmpfiles --sort=name --clamp-mtime --mtime="@${SOURCE_DATE_EPOCH:-$(date +%s)}" --mode=go=rX,u+rw,a-s --owner=root --group=root --numeric-owner
  cd $origdir
  cp -f $tmpdir/$tarball $1
  rm -f $tmpdir/*
  rmdir $tmpdir
fi