mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-29 04:00:42 +00:00
Move system-wide scripts to systemwide folder from home
This commit is contained in:
parent
39c572c04a
commit
cf475c580e
3 changed files with 0 additions and 0 deletions
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Must be ran as root"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Make sure the partition is mounted according to fstab
|
||||
mount /mnt/arch
|
||||
|
||||
# Mount necessary directories for chroot to be possible
|
||||
mount --types proc /proc /mnt/arch/proc
|
||||
mount --rbind /sys /mnt/arch/sys
|
||||
mount --make-rslave /mnt/arch/sys
|
||||
mount --rbind /dev /mnt/arch/dev
|
||||
mount --make-rslave /mnt/arch/dev
|
||||
|
||||
# Chroot with bash shell
|
||||
chroot /mnt/arch /bin/bash
|
||||
|
||||
# Unmount recursively mounted directories
|
||||
umount -l /mnt/arch/dev{/shm,/pts,}
|
||||
umount -R /mnt/arch
|
||||
|
||||
# Remount partition accordingly to fstab
|
||||
# (the above umountings will unmount gentoo completely,
|
||||
# which means that remounting is necessary)
|
||||
mount /mnt/arch
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Make sure the partition is mounted according to fstab
|
||||
mount /mnt/gentoo 2>/dev/null
|
||||
|
||||
# Mount necessary directories for chroot to be possible
|
||||
mount --types proc /proc /mnt/gentoo/proc
|
||||
mount --rbind /sys /mnt/gentoo/sys
|
||||
mount --make-rslave /mnt/gentoo/sys
|
||||
mount --rbind /dev /mnt/gentoo/dev
|
||||
mount --make-rslave /mnt/gentoo/dev
|
||||
|
||||
# Chroot with bash shell
|
||||
chroot /mnt/gentoo /bin/bash
|
||||
|
||||
# Unmount recursively mounted directories
|
||||
umount -l /mnt/gentoo/dev{/shm,/pts,}
|
||||
umount -R /mnt/gentoo
|
||||
|
||||
# Remount partition accordingly to fstab
|
||||
# (the above umountings will unmount gentoo completely,
|
||||
# which means that remounting is necessary)
|
||||
mount /mnt/gentoo
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script to perform incremental backups using rsync
|
||||
# It is often ran as crontab rule for automated backup solution
|
||||
#
|
||||
# This script will respect .rsync-filter files, which can be used
|
||||
# to define custom exclude rules for files/dirs in which it is present
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Invalid amount of arguments passed!"
|
||||
echo "Arguments: [Source path] [Backup path]"
|
||||
echo " Source path: directory to be backed up, usually '/'"
|
||||
echo " Backup path: directory to back up to (destination), usually mounted drive"
|
||||
exit
|
||||
fi
|
||||
|
||||
SOURCE_DIR="$1"
|
||||
BACKUP_DIR="$2"
|
||||
DATETIME="$(date '+%Y-%m-%d_%H:%M:%S')"
|
||||
BACKUP_PATH="${BACKUP_DIR}/${DATETIME}"
|
||||
LATEST_LINK="${BACKUP_DIR}/latest"
|
||||
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
rsync -avHAXS \
|
||||
--delete \
|
||||
--filter='dir-merge /.rsync-filter' \
|
||||
--link-dest "${LATEST_LINK}" \
|
||||
"${@:3}" "${SOURCE_DIR}/" "${BACKUP_PATH}"
|
||||
|
||||
# Only attempt to override the symlink if we made new backup_path
|
||||
# user might've passed --dry-run option in which case we wouldn't
|
||||
# want to override latest symlink to non-existent location
|
||||
if [ -d "${BACKUP_PATH}" ]; then
|
||||
rm "${LATEST_LINK}" 2>/dev/null
|
||||
ln -s "${BACKUP_PATH}" "${LATEST_LINK}"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue