Browse Source

Add license headers

master v0.2.1
Janek Bevendorff 7 years ago
parent
commit
c8eb94bd95
  1. 25
      client/usr/bin/rs-backup-run
  2. 30
      install.sh
  3. 26
      server/usr/bin/rs-detect-distribution
  4. 26
      server/usr/bin/rs-rotate
  5. 26
      server/usr/bin/rs-run-ssh-cmd
  6. 25
      server/usr/bin/rs-version
  7. 23
      server/usr/sbin/rs-add-ssh-key
  8. 26
      server/usr/sbin/rs-add-user
  9. 25
      server/usr/sbin/rs-rotate-cron
  10. 26
      server/usr/sbin/rs-update-passwd
  11. 28
      server/usr/sbin/spin-down-storage

25
client/usr/bin/rs-backup-run

@ -1,12 +1,31 @@
#!/bin/bash
##
# rs-backup-run
# Copyright (C) 2013-2014 by Janek Bevendorff
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Script to push backups to a remote rsync backup server.
# Read the source code or use with --help parameter for
# further usage information.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
@ -21,7 +40,7 @@
# Additional internal config
###############################################################################
_VERSION=0.2.0
_VERSION=0.2.1
_GLOBAL_INCLUSION_PATTERN_FILE="/etc/rs-backup/include-files"
_FORCED_INCLUSION_PATTERN_FILE=""
_SKIP_HOME_DIRS=false

30
install.sh

@ -1,6 +1,8 @@
#!/bin/sh
##
# Copyright (C) 2014 Janek Bevendorff
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Install script for installing server and client script files
#
# The MIT License (MIT)
@ -35,6 +37,10 @@ if [ $UID -ne 0 ]; then
exit 1
fi
###############################################################################
# Global variables
###############################################################################
DISTRIBUTION="$(./server/usr/bin/rs-detect-distribution)"
COMPONENT="$1"
MODE="install"
@ -42,12 +48,21 @@ if [[ "$(basename $0)" == "uninstall.sh" ]]; then
MODE="uninstall"
fi
###############################################################################
# Command aliases
###############################################################################
CP="cp -vr --preserve=mode,timestamps,links,xattr"
RM="rm -Rvf"
MKDIR="mkdir -pv"
###############################################################################
# Install mode
###############################################################################
if [[ $MODE == "install" ]]; then
# Server component
if [[ $COMPONENT == "all" ]] || [[ $COMPONENT == "server" ]]; then
echo "Installing Server component..."
@ -147,6 +162,7 @@ if [[ $MODE == "install" ]]; then
echo "Done."
# Client component
elif [[ $COMPONENT == "all" ]] || [[ $COMPONENT == "client" ]]; then
echo "Installing client component..."
@ -159,6 +175,10 @@ if [[ $MODE == "install" ]]; then
echo "Done."
fi
###############################################################################
# Uninstall mode
###############################################################################
elif [[ "$MODE" == "uninstall" ]]; then
echo "This will uninstall rs-backup suite from this computer."
echo "Selected components for removal: $COMPONENT"
@ -172,6 +192,7 @@ elif [[ "$MODE" == "uninstall" ]]; then
exit
fi
# Server component
if [[ $COMPONENT == "all" ]] || [[ $COMPONENT == "server" ]]; then
echo "Uninstalling server component..."
@ -184,7 +205,8 @@ elif [[ "$MODE" == "uninstall" ]]; then
done
echo "Done."
# Client component
elif [[ $COMPONENT == "all" ]] || [[ $COMPONENT == "client" ]]; then
echo "Uninstalling client component..."
@ -206,8 +228,4 @@ elif [[ "$MODE" == "uninstall" ]]; then
echo
echo "INFO: Your backup folder was not removed to preserve your data."
echo " If you don't need it anymore, just delete it."
else
# Program should never end here
echo "Nothing to do." >&2
exit 1
fi

26
server/usr/bin/rs-detect-distribution

@ -1,4 +1,30 @@
#!/bin/sh
##
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Print out Linux distribution identification.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
# Check if lsb_release exists
command -v lsb_release > /dev/null 2>&1

26
server/usr/bin/rs-rotate

@ -1,4 +1,30 @@
#!/bin/sh
##
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Rotate backup revisions. Intended for use with cron.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
if [ "$1" == "" ]; then
echo "Usage: $(basename $0) <rsnapshot config>"

26
server/usr/bin/rs-run-ssh-cmd

@ -1,4 +1,30 @@
#!/bin/sh
##
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Run a restricted command in an SSH session.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
home_dir=$1

25
server/usr/bin/rs-version

@ -1,13 +1,32 @@
#!/bin/sh
##
# rs-version
# Copyright (C) 2013-2014 by Janek Bevendorff
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Print out version and copyright information for rs-backup.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
VERSION="0.2.0"
VERSION="0.2.1"
echo -e "\e[1mrs-backup-suite\e[0m version ${VERSION}"
echo "Copyright (C) 2013-2014 Janek Bevendorff"

23
server/usr/sbin/rs-add-ssh-key

@ -1,10 +1,29 @@
#!/bin/sh
##
# rs-add-ssh-key
# Copyright (C) 2013-2014 by Janek Bevendorff
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Add SSH key to a backup user for passwordless login
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" == "" ]; then

26
server/usr/sbin/rs-add-user

@ -1,12 +1,30 @@
#!/bin/sh
##
# rs-add-user
# Copyright (C) 2013-2014 by Janek Bevendorff
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Set up a backup user
# Set up a backup user.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
if [ "$1" == "" ] || [ "$2" == "" ]; then
. rs-version
echo "Usage: $(basename $0) <remote host> <remote username> [<ssh public key file>]"

25
server/usr/sbin/rs-rotate-cron

@ -1,5 +1,30 @@
#!/bin/sh
##
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Create daily, weekly or monthly snapshots from manual push backups
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
if [ "$1" == "" ]; then
. rs-version

26
server/usr/sbin/rs-update-passwd

@ -1,4 +1,30 @@
#!/bin/sh
##
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Update passwd file in chroot folder based on the contents of /etc/passwd.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
. /etc/rs-backup/server-config

28
server/usr/sbin/spin-down-storage

@ -1,5 +1,31 @@
#!/bin/sh
# Check if disk has been used since last check and spin it down if not
##
# Copyright (C) 2013-2014 Janek Bevendorff
# Website: http://www.refining-linux.org/
#
# Utility program. Check if disk has been used since last check and spin it down if not.
# Some distributions such as Synology DSM implement this by themselves.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
##
if [ "${1}" == "" ]; then
echo "Usage: $(basename ${0}) <device file>"

Loading…
Cancel
Save