From c8eb94bd9550bdff9617f3f7c213a93fa053b063 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sun, 5 Oct 2014 01:09:30 +0200 Subject: [PATCH] Add license headers --- client/usr/bin/rs-backup-run | 25 +++++++++++++++++++--- install.sh | 30 +++++++++++++++++++++------ server/usr/bin/rs-detect-distribution | 26 +++++++++++++++++++++++ server/usr/bin/rs-rotate | 26 +++++++++++++++++++++++ server/usr/bin/rs-run-ssh-cmd | 26 +++++++++++++++++++++++ server/usr/bin/rs-version | 25 +++++++++++++++++++--- server/usr/sbin/rs-add-ssh-key | 23 ++++++++++++++++++-- server/usr/sbin/rs-add-user | 26 +++++++++++++++++++---- server/usr/sbin/rs-rotate-cron | 25 ++++++++++++++++++++++ server/usr/sbin/rs-update-passwd | 26 +++++++++++++++++++++++ server/usr/sbin/spin-down-storage | 28 ++++++++++++++++++++++++- 11 files changed, 267 insertions(+), 19 deletions(-) diff --git a/client/usr/bin/rs-backup-run b/client/usr/bin/rs-backup-run index e0a75b2..e4ca1ee 100755 --- a/client/usr/bin/rs-backup-run +++ b/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 diff --git a/install.sh b/install.sh index 8d130a8..d2d3d91 100755 --- a/install.sh +++ b/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 diff --git a/server/usr/bin/rs-detect-distribution b/server/usr/bin/rs-detect-distribution index e9e7e4b..d196a3d 100755 --- a/server/usr/bin/rs-detect-distribution +++ b/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 diff --git a/server/usr/bin/rs-rotate b/server/usr/bin/rs-rotate index 53f18dc..ace867d 100755 --- a/server/usr/bin/rs-rotate +++ b/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) " diff --git a/server/usr/bin/rs-run-ssh-cmd b/server/usr/bin/rs-run-ssh-cmd index 362c4fc..c4babf3 100755 --- a/server/usr/bin/rs-run-ssh-cmd +++ b/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 diff --git a/server/usr/bin/rs-version b/server/usr/bin/rs-version index 4e729ff..6536919 100755 --- a/server/usr/bin/rs-version +++ b/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" \ No newline at end of file diff --git a/server/usr/sbin/rs-add-ssh-key b/server/usr/sbin/rs-add-ssh-key index 9d380ee..eb5f4bd 100755 --- a/server/usr/sbin/rs-add-ssh-key +++ b/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 diff --git a/server/usr/sbin/rs-add-user b/server/usr/sbin/rs-add-user index 7c1cda3..deb8045 100755 --- a/server/usr/sbin/rs-add-user +++ b/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) []" diff --git a/server/usr/sbin/rs-rotate-cron b/server/usr/sbin/rs-rotate-cron index ea4808c..b46835d 100755 --- a/server/usr/sbin/rs-rotate-cron +++ b/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 diff --git a/server/usr/sbin/rs-update-passwd b/server/usr/sbin/rs-update-passwd index 7f86824..c1d70cc 100755 --- a/server/usr/sbin/rs-update-passwd +++ b/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 diff --git a/server/usr/sbin/spin-down-storage b/server/usr/sbin/spin-down-storage index cff518c..0721e0d 100755 --- a/server/usr/sbin/spin-down-storage +++ b/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}) "