system/partimage: Added (backup system).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2016-10-24 19:35:30 +07:00 committed by Willy Sudiarto Raharjo
parent 8297f5ec58
commit ea2a3496ed
10 changed files with 672 additions and 0 deletions

18
system/partimage/README Normal file
View file

@ -0,0 +1,18 @@
partimage (backup system)
Partimage is opensource disk backup software. It saves partitions having
a supported filesystem on a sector basis to an image file. Although it
runs under Linux, Windows and most Linux filesystems are supported. The
image file can be compressed to save disk space and transfer time and
can be split into multiple files to be copied to CDs or DVDs.
Partimage has a textmode user interface, plus non-interactive batch
mode operation. It supports these filesystems: ext2, ext3, reiserfs,
fat16, fat32, hpfs, jfs, xfs, ufs, hfs, ntfs. It does NOT support ext4
or btrfs. Users needing a tool like this for ext4 or btrfs are advised
to try fsarchiver.
The daemon (partimaged) is included, but the SlackBuild author hasn't
tested it. Read /usr/doc/partimage-0.6.9/README.partimaged and proceed at
your own risk. One thing not mentioned there is that partimaged requires
a dedicated user account called partimag.

View file

@ -0,0 +1,45 @@
diff -Naur partimage-0.6.9/src/client/imagefile.cpp partimage-0.6.9.patched/src/client/imagefile.cpp
--- partimage-0.6.9/src/client/imagefile.cpp 2010-07-25 11:30:31.000000000 -0400
+++ partimage-0.6.9.patched/src/client/imagefile.cpp 2016-10-21 13:28:03.035049317 -0400
@@ -783,7 +783,7 @@
else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression
{
showDebug(1, "open gzip\n");
- m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "wb"); //"wb1h");
+ m_gzImageFile = gzdopen(m_nFdImage, "wb"); //"wb1h");
if (m_gzImageFile == NULL)
{
showDebug(1, "error:%d %s\n", errno, strerror(errno));
@@ -1098,7 +1098,7 @@
}
else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression
{
- m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "rb");
+ m_gzImageFile = gzdopen(m_nFdImage, "rb");
if (m_gzImageFile == NULL)
THROW(ERR_ERRNO, errno);
else
diff -Naur partimage-0.6.9/src/client/imagefile.h partimage-0.6.9.patched/src/client/imagefile.h
--- partimage-0.6.9/src/client/imagefile.h 2010-07-25 11:30:31.000000000 -0400
+++ partimage-0.6.9.patched/src/client/imagefile.h 2016-10-21 13:28:03.036049317 -0400
@@ -41,7 +41,7 @@
COptions m_options;
FILE *m_fImageFile;
- gzFile *m_gzImageFile;
+ gzFile m_gzImageFile;
BZFILE *m_bzImageFile;
int m_nFdImage;
diff -Naur partimage-0.6.9/src/client/misc.h partimage-0.6.9.patched/src/client/misc.h
--- partimage-0.6.9/src/client/misc.h 2010-07-25 11:30:31.000000000 -0400
+++ partimage-0.6.9.patched/src/client/misc.h 2016-10-21 13:28:09.708049742 -0400
@@ -36,7 +36,7 @@
#endif
#ifndef makedev
- #define makedev(maj,min) (((maj) << 8) | min))
+ #define makedev(maj,min) (((maj) << 8) | (min))
#endif
// =======================================================

View file

@ -0,0 +1,198 @@
.\"
.\" Copyright (c) 2001 Partition Image Team
.\" All rights reserved.
.\"
.\" Permission is granted to copy, distribute and/or modify this
.\" document under the terms of the GNU Free Documentation License,
.\" Version 1.1 or any later version published by the Free Software
.\" Foundation; with no Invariant Sections, with no Front-Cover Texts, and
.\" with no Back-Cover Texts.
.\"
.ig
A copy of the GNU Free Documentation License is available in the
Debian package in the file /usr/share/doc/m17n-docs/copyright.
..
.ig
A copy of the GNU Free Documentation License is available in the
Debian source package in the file debian/copyright.
..
.TH PARTIMAGE "1" "30 May, 2002" "SlackBuilds.org" "Partition Image Manual"
.SH NAME
partimage \- back up and restore disk partitions
.SH SYNOPSIS
.B partimage
.RB [ " \-bcdehimMnoSvwy " ]
.RB [ \-B\ 'pattern\ response\ string' ]
.RB [ \-z\ compresslevel ]
.RB [ \-V\ volumesize ]
.RB [ \-f\ actionatend ]
.RB [ \-s\ server ]
.RB [ \-p\ port ]
.RB [ \-a\ mountoptions ]
.RB [ \-U\ username ]
.RB [ \-P\ password ]
.RB [ \-g\ loglevel ]
[
.I "save"
.I "device"
.I "image_file"
]
.br
.B partimage
.RB [ " \-bcdehimMnoSvwy " ]
.RB [ \-B\ 'pattern\ response\ string' ]
.RB [ \-z\ compresslevel ]
.RB [ \-V\ volumesize ]
.RB [ \-f\ actionatend ]
.RB [ \-s\ server ]
.RB [ \-p\ port ]
.RB [ \-a\ mountoptions ]
.RB [ \-U\ username ]
.RB [ \-P\ password ]
.RB [ \-g\ loglevel ]
[
.I "restore"
.I "device"
.I "image_file/'stdin'"
]
.br
.B partimage
[
.I "restmbr"
.I "image_file"
]
.br
.B partimage
[
.I "imginfo"
.I "image_file"
]
.SH DESCRIPTION
\fIpartimage\fR backs up disk partitions into image files and restores them.
.SH OPTIONS
.TP
.B \-z val, --compress val
Set image file compression level:
.br
val=0: don't compress: very fast but very big image file
.br
val=1: compress using gzip: fast and small image file (default)
.br
val=2: compress using bzip2: very slow and very small image file
.TP
.B \-c, --nocheck
Don't check the partition before saving.
.TP
.B \-o, --overwrite
Overwrite the existing image file without confirmation.
.TP
.B \-d, --nodesc
Don't ask any description for the image file.
.TP
.B \-V vol, --volume vol
Split image into multiple volumes files. vol will be the size in KB of volumes.
.TP
.B \-w, --waitvol
Wait for a confirmation after each volume change.
.TP
.B \-e, --erase
Erase empty blocks on restore with zero bytes.
.TP
.B \-m, --allowmnt
Don't fail if the partition is mounted. Dangerous!
.TP
.B \-M, --nombr
Don't create a backup of the MBR (Mast Boot Record) in the image file.
.TP
.B \-h, --help
Show help.
.TP
.B \-v, --version
Show version.
.TP
.B \-f action, --finish action
Action to do if finished successfully:
.br
action=0: wait (do nothing)
.br
action=1: halt (power off the computer)
.br
action=2: reboot (restart the computer)
.br
action=3: quit
.TP
.B \-b, --batch
batch mode: the GUI won't wait for an user action.
.TP
.B \-B 'pattern response string', --fully-batch 'pattern response string'
full batch mode: the GUI is not being displayed. Rather status messages
are displayed as normal text.
The pattern response string has the following format:
.br
.B \'<glob-pattern>=<response-value>;...\'
.br
where the glob pattern is matched against the string
.B <window-title>/<message-text>
of the message dialogue box to be displayed. For dialog boxes with
buttons in the window, the <response> must be the exact button text.
The pattern response string usually needs to be quoted as above.
.TP
.B \-y, --nosync
Don't synchronize the disks at the end of the operation. Dangerous!
.TP
.B \-s addr, --server addr
Give partimaged server's ip address.
.TP
.B \-p port, --port port
Give partimaged server's listening port.
.TP
.B \-g debuglevel, --debug debuglevel
Set the debug level to debuglevel (defaults to 1).
.TP
.B \-n, --nossl
Disable SSL in network mode.
.TP
.B \-S, --simulate
Simulation of restoration mode.
.TP
.B \-a str, --automnt str
Automatic mount with X options. Read the doc for more details.
.TP
.B \-U name, --username=name
Username to authenticate to partimage server.
.TP
.B \-P pass, --password=pass
Password for authentication of user to partimage server.
.SH EXAMPLES
partimage -z1 -o -d save /dev/hda12 /mnt/backup/redhat-6.2.partimg.gz
.br
partimage -z1 -om save /dev/hda9 /mnt/backup/win95-osr2.partimg.gz
.br
partimage restore /dev/hda13 /mnt/backup/suse-6.4.partimg
.br
cat debian.partimg.000 debian.partimg.001 | partimage restore /dev/hda1 stdin
.br
partimage restmbr /mnt/backup/debian-potato-2.2.partimg.bz2
.br
partimage imginfo /mnt/backup/debian-potato-2.2.partimg.bz2
.SH SEE ALSO
.BR partimaged(8)
.SH DIAGNOSTICS
You can read options set at compile time running 'partimage -i'.
.PP
When using batchmode, exit status is normally 0.
.SH CAVEATS
Supported file systems: Ext2/3, Reiser3, FAT16/32, HPFS, JFS, XFS, UFS(beta),
HFS(beta), NTFS(experimental)
.PP
Btrfs and Ext4 are not supported.
.PP
FAT12 will never be supported.
.SH BUGS
Refer to BUGS file to read them.
.SH AUTHOR
.nf
Franck Ladurelle <ladurelf@partimage.org>
.nf
Francois Dupoux <fdupoux@partimage.org>

View file

@ -0,0 +1,39 @@
.TH "partimaged-passwd" "8" "0.1" "Michael Biebl <biebl@teco.edu>" "Partition Image Server Configuration"
.SH "NAME"
.LP
partimaged\-passwd \- Manage partimaged user accounts
.SH "SYNTAX"
.LP
partimaged\-passwd [\-Dhl] \fIusername\fP \fIpassword\fR
.br
partimaged\-passwd [\-Dhl] \fIusername\fP
.SH "DESCRIPTION"
.LP
partimaged can either authenticate against local user accounts (This needs
access to /etc/shadow. As this is a potential security risk this method is
not recommended) or its own password database in
\fI/etc/partimaged/passwd.db\fR. To simplify the management of the partimaged
user database this tool was written. It allows to easily add and remove users
or list the users in the database. All users in this database are allowed to
access the partimaged server.
.SH "OPTIONS"
.LP
.TP
\fB\-D\fR username
Delete the specified user from the password file.
.TP
\fB\-l\fR
List users in password file and exit.
.TP
\fB\-h\fR
Output help information and exit.
.SH "FILES"
.LP
\fI/etc/partimaged/passwd.db\fP
.SH "AUTHORS"
.LP
Michael Biebl <biebl@debian.org>
.SH "SEE ALSO"
.LP
partimaged(8), partimagedusers(5), partimage(1)

View file

@ -0,0 +1,72 @@
.\"
.\" Copyright (c) 2001 Partition Image Team
.\" All rights reserved.
.\"
.\" Permission is granted to copy, distribute and/or modify this
.\" document under the terms of the GNU Free Documentation License,
.\" Version 1.1 or any later version published by the Free Software
.\" Foundation; with no Invariant Sections, with no Front-Cover Texts, and
.\" with no Back-Cover Texts.
.\"
.ig
A copy of the GNU Free Documentation License is available in the
Debian package in the file /usr/share/doc/m17n-docs/copyright.
..
.ig
A copy of the GNU Free Documentation License is available in the
Debian source package in the file debian/copyright.
..
.TH partimaged 8 "30 May, 2002" "SlackBuilds.org" "Partition Image Server Manual"
.SH NAME
partimaged \- backup/restore partitions server
.SH SYNOPSIS
.B partimaged
.RB [ " \-DhLv " ]
.RB [ \-r\ directory ]
.RB [ \-p\ port ]
.RB [ \-g\ loglevel ]
.SH DESCRIPTION
.B partimaged
can be used to use partimage over the network. Run partimaged on the computer
where you want to save image files and run partimage on stations you want to
backup.
.SH OPTIONS
.TP
.B \-D --daemon
Start server in daemon mode.
.TP
.B \-h --help
Show help
.TP
.B \-L --nologin
Accept only clients with login support disabled.
Clients with login support enabled will be refused.
This option should be used only if clients ask it.
.TP
.B \-v --version
Show version
.TP
.B \-p port --port port
Give server's listening port.
.TP
.B \-d directory --dest directory
Directory where the images will be stored.
.TP
.B \-g debuglevel --debug debuglevel
Set the debug level to debuglevel (defaults to 1).
.TP
.B \-r dir --chroot dir
Use chroot to improve security.
.SH SEE ALSO
.BR partimage(1) ,
.BR partimagedusers(5),
.BR partimaged-passwd(8)
.SH DIAGNOSTICS
You can read options set at compile time running 'partimage -i'.
.SH BUGS
Refer to BUGS file to read them.
.SH AUTHOR
.nf
Franck Ladurelle <ladurelf@partimage.org>
Francois Dupoux <fdupoux@partimage.org>

View file

@ -0,0 +1,54 @@
.\"
.\" Copyright (c) 2001 Partition Image Team
.\" All rights reserved.
.\"
.\" Permission is granted to copy, distribute and/or modify this
.\" document under the terms of the GNU Free Documentation License,
.\" Version 1.1 or any later version published by the Free Software
.\" Foundation; with no Invariant Sections, with no Front-Cover Texts, and
.\" with no Back-Cover Texts.
.\"
.ig
A copy of the GNU Free Documentation License is available in the
Debian package in the file /usr/share/doc/m17n-docs/copyright.
..
.ig
A copy of the GNU Free Documentation License is available in the
Debian source package in the file debian/copyright.
..
.TH partimagedusers 5 "23 June 2001" "SlackBuilds.org" "Partition Image Manual"
.SH NAME
partimagedusers \- list of allowed users.
.SH DESCRIPTION
The
.B partimagedusers
This file lists all local users that are allowed to connect to partimaged.
This file must belong to user partimaged runs as (normally 'partimag'), and must have permissions
-rw------- or -r-------.
.PP
The configuration file consists of a set of lines.
All empty lines will be ignored.
Comments begin with a #, and everything on the line afterwards is ignored.
.PP
Put all allowed users on the remaining lines, one login per line.
.SH EXAMPLE
.LP
.PD .1v
.RS
.nf
#
# Sample users list for partimaged
# We only allow user2 and user6 to connect partimaged
# from partimage
user2
user6
# end of list
.PD
.SH "SEE ALSO"
.BR partimage(1) ,
.BR partimaged(8),
.BR partimaged-passwd(5)
.SH AUTHOR
.nf
Franck Ladurelle <ladurelf@partimage.org>

View file

@ -0,0 +1,96 @@
#!/bin/sh
# Slackware build script for partimage
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=partimage
VERSION=${VERSION:-0.6.9}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# apply patches from Gentoo ebuild:
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-block/partimage/files
# my patch is made from their zlib-1.2.5.2 and minor-typo, rolled up into
# one patch that will apply with -p1.
patch -p1 < $CWD/compilefix.diff
# man pages and partimaged-passwd script came from Debian:
# http://http.debian.net/debian/pool/main/p/partimage/partimage_0.6.9-3.debian.tar.xz
# man pages slightly modified (typos fixed).
for i in $CWD/man/*; do
page="$( basename $i | cut -d. -f1 )"
sect="$( basename $i | cut -d. -f2 )"
mkdir -p $PKG/usr/man/man$sect
gzip -9c < $i > $PKG/usr/man/man$sect/$page.$sect.gz
done
mkdir -p $PKG/usr/sbin
install -m0755 -oroot -groot $CWD/${PRGNAM}d-passwd $PKG/usr/sbin
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make
make install-strip DESTDIR=$PKG
# docs already installed, just add this:
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="partimage"
VERSION="0.6.9"
HOMEPAGE="http://www.partimage.org/Main_Page"
DOWNLOAD="http://downloads.sourceforge.net/project/partimage/stable/0.6.9/partimage-0.6.9.tar.bz2"
MD5SUM="1bc046fd915c5debbafc85729464e513"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

View file

@ -0,0 +1,121 @@
#!/bin/bash
####################################################
# partimaged-passwd
# Copyright (C) 2006 Michael Bieb <biebl@debian.org>
####################################################
DB_LOAD=""
DB_DUMP=""
PASSWD_FILE="/etc/partimaged/passwd.db"
if [ $UID -ne 0 ] ; then
:
echo "This program has to be run as root!"
exit 1
fi
# Check for a version of db_load/db_dump
check_db_utils() {
for i in 5.1 4.8 4.7; do
if [ -x /usr/bin/db${i}_load ] ; then
DB_LOAD=/usr/bin/db${i}_load
DB_DUMP=/usr/bin/db${i}_dump
return 0
fi
done
return 1
}
help() {
echo "Manage partimaged user database."
echo
echo "Usage:"
echo " $0 [-Dhl] username password"
echo " $0 [-Dhl] username"
echo
echo " -D Delete user."
echo " -h Display this help message."
echo " -l List existing users."
echo
}
delete_user() {
echo "Deleting user $1..."
$DB_DUMP -p $PASSWD_FILE | sed -e '1,/HEADER=END/d' -e '/DATA=END/,$d' | sed 's/^[ \t]*//' | sed "/^$1$/{n;d}" | sed "/^$1$/d" | $DB_LOAD -T -t hash ${PASSWD_FILE}.new
mv ${PASSWD_FILE}.new $PASSWD_FILE
fix_rights
}
add_user() {
echo "Adding user $1..."
echo -e "$1\n$2" | $DB_LOAD -T -t hash $PASSWD_FILE
fix_rights
}
list_users() {
[ -f $PASSWD_FILE ] || exit 0
echo "Users:"
$DB_DUMP -p $PASSWD_FILE | sed -e '1,/HEADER=END/d' -e '/DATA=END/,$d' | sed 's/^[ \t]*//' | sed -n '1~2p'
}
fix_rights() {
chmod 640 $PASSWD_FILE
chown partimag:partimag $PASSWD_FILE
}
if ! check_db_utils ; then
echo "Could not find db_load/db_dump!"
echo "Please install the db5.1-util package."
exit 1
fi
while getopts D:hl opt
do
case "$opt" in
D)
delete_user $OPTARG
exit 0
;;
h)
help
exit 0
;;
l)
list_users
exit 0
;;
[?])
help
exit 1
;;
esac
done
shift $((${OPTIND}-1))
if [ $# -eq 1 ] ; then
echo -n "New password: "
read -s passwd1
echo
echo -n "Re-type new password: "
read -s passwd2
echo
if [ "$passwd1" != "$passwd2" ] ; then
echo "Passwords do not match!"
exit 1
elif [ -z $passwd1 ] ; then
echo "Please supply a valid password!"
exit 1
else
add_user $1 $passwd1
fi
elif [ $# -eq 2 ] ; then
add_user $1 $2
else
help
exit 1
fi
exit 0

View file

@ -0,0 +1,19 @@
# 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 ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
partimage: partimage (backup system)
partimage:
partimage: Partimage is opensource disk backup software. It saves partitions
partimage: having a supported filesystem on a sector basis to an image
partimage: file. Although it runs under Linux, Windows and most Linux
partimage: filesystems are supported. The image file can be compressed to save
partimage: disk space and transfer time and can be split into multiple files to
partimage: be copied to CDs or DVDs.
partimage:
partimage:
partimage: