Removed unused resources

This commit is contained in:
2022-08-15 20:23:00 +08:00
parent afbbfee818
commit 824fcee942
15 changed files with 16 additions and 851 deletions

View File

@@ -0,0 +1,16 @@
#!/bin/bash
function mkuserdirs {
local PROFILE PKG_DIR i
PROFILE=$( cygpath $USERPROFILE )
for i in $( ls $PROFILE | grep -o "^[A-Z][a-z]\+$" ); do
ln -vs "$PROFILE/$i" $HOME/
done
# Package Directory
PKG_DIR="$APPDATA/../Local/Packages"
if [ -d "$PKG_DIR" ]; then
ln -vs "$PKG_DIR" $HOME/
fi
}

View File

@@ -1,96 +0,0 @@
#!/bin/bash
source ./config.sh
# IO Redirection
exec > $LOGFILE
exec 2> $ERRLOG
if [[ -n $BMOUNT ]] && ! grep -qs $BMOUNT /proc/mounts; then
echo Mounting $BMOUNT ...
mount $BMOUNT
MOUNTED=$?
fi
if ! [ -d $BAKDIR ]; then
mkdir $BAKDIR
fi
echo Begin backup schedule:
echo Date: $(date)
while read line; do
# substring first char
firstChr=${line::1}
# if line is not empty and does not start with "#"
if [ $firstChr ] && [ $firstChr != "#" ]; then
# file and arguments are seperated by ":"
IFS=':' read -ra ARGS <<< "$line"
# Get file
FILE=${ARGS[0]}
# if file exists
if [ -a $FILE ]; then
# filename
FILENAME=$(basename $FILE)
# set the backup name YYYYMMDDhhmm
BACKUPFILE=$(date +$FILENAME.%Y%m%d%H%M.tar.gz)
# exclude file
EXCLUDE="exclude/${ARGS[1]}"
CHDIR=$(dirname $FILE)
if [ -d $FILE ]; then
CHDIR="$FILE/../"
fi
if [ -f $EXCLUDE ]; then
tar zcf "$BAKDIR/$BACKUPFILE" -C $CHDIR $FILENAME -X $EXCLUDE
else
tar zcf "$BAKDIR/$BACKUPFILE" -C $CHDIR $FILENAME
fi
# count backup file
fCount=$(ls $BAKDIR/$FILENAME.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].tar.gz|wc -l)
echo " Check for existing backups "$FILENAME \(Have: $fCount\)
# keep up to X backups
if [ $fCount -ne $KEEP ]; then
# delete count
dCount=`expr $fCount - $KEEP`
# loop over files
for files in $BAKDIR/*$FILENAME*.gz; do
if [ 0 -lt $dCount ]; then
# remove expired file
echo " Removing expired backup: "$files
rm "$files";
# dCount --
dCount=$((dCount-1));
fi
done
fi
fi
fi
# echo --\> $line
done < backup_list
if [[ "$MOUNTED" = 0 ]]; then
umount $BMOUNT
fi

View File

@@ -1,11 +0,0 @@
# git backups
/home/git/repositories/blogAPI.git
/home/git/repositories/wenku8.git
/home/git/repositories/wenku8-android.git
/home/git/repositories/MetroSSH.git
/home/git/repositories/wconv.git
/home/git/repositories/utils.git
# www
/var/www/wenku8
/var/www/file:file.txt

View File

@@ -1,9 +0,0 @@
#!/bin/bash`
LOGFILE=backup.log
ERRLOG=backup_errors.log
BMOUNT=/mnt/backup
BAKDIR=$BMOUNT/backup/cron
KEEP=7

View File

@@ -1,13 +0,0 @@
#!/bin/bash
PUBKEY_URL="https://cygwin.com/key/pubring.asc"
TMP=$( mktemp )
function __o { rm $TMP; }
trap __o EXIT
curl "$PUBKEY_URL" > $TMP
gpg2 --import $TMP

View File

@@ -1,2 +0,0 @@
#!/bin/bash
/opt/setup-x86_64.exe -qg

View File

@@ -1,27 +0,0 @@
#!/bin/bash
SETUP_BIN="/opt/setup-x86_64.exe"
SIG_URL="https://cygwin.com/setup-x86_64.exe.sig"
SETUP_URL="https://cygwin.com/setup-x86_64.exe"
TMP_BIN=$( mktemp )
TMP_SIG=$( mktemp )
function __o { rm $TMP_BIN; rm $TMP_SIG; }
trap __o EXIT
echo "Downloading Signature ..."
curl -s "$SIG_URL" > $TMP_SIG
echo "Downloading setup binary ..."
curl -s "$SETUP_URL" > $TMP_BIN
echo "Verifying Signature ..."
gpg2 -q --verify $TMP_SIG $TMP_BIN
if [ $? -ne 0 ]; then
echo "ERROR: Bad Signature!"
else
echo "Installing setup"
cp $TMP_BIN $SETUP_BIN
chmod +x $SETUP_BIN
fi

View File

@@ -1,11 +0,0 @@
#!/bin/bash
PROFILE=$( cygpath $USERPROFILE )
for i in $( ls $PROFILE | grep -o "^[A-Z][a-z]\+$" ); do
ln -vs "$PROFILE/$i" $HOME/
done
# Package Directory
PKG_DIR="$APPDATA/../Local/Packages"
if [ -d "$PKG_DIR" ]; then
ln -vs "$PKG_DIR" $HOME/
fi

View File

@@ -1,30 +0,0 @@
#!/bin/bash
if [ -f $1 ]; then
source $1
fi
uname | grep -q Linux
LINUX=$?
if [ "$LINUX" -eq "0" ]; then
HOST=/etc/hosts
else
HOST=/cygdrive/c/Windows/System32/drivers/etc/hosts
fi
if [ ${HOSTNAMES[0]+1} ]; then
for i in {0..99};
do
if [ ${HOSTNAMES[$i]+1} ]; then
XID="# Automated Host Def. Id. $i"
if grep -q "$XID" $HOST; then
REC=$( echo "s/.*$XID$/${HOSTNAMES[$i]}\ $XID/g" | sed "s/\ /\\\ /g" )
sed -i "$REC" $HOST
else
echo ${HOSTNAMES[$i]} $XID >> $HOST
fi
fi
done
fi

View File

@@ -1,7 +0,0 @@
#!/bin/bash
HOSTNAMES=()
for i in {0..99}; do
HOSTNAMES[$i]=""
done