UNFUCKEDR
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
username=princesspi
|
||||||
|
echo "UNFUCK HOMEDIR PERMS"
|
||||||
|
sudo chown -R $username:$username /home/$username 2>/dev/null
|
||||||
|
sudo chmod 755 /home/$username 2>/dev/null
|
||||||
|
sudo chmod 700 /home/$username/.ssh 2>/dev/null
|
||||||
|
sudo chmod 600 /home/$username/.ssh/id_rsa 2>/dev/null
|
||||||
|
sudo chmod 644 /home/$username/.ssh/id_rsa.pub 2>/dev/null
|
||||||
|
sudo chmod 600 /home/$username/.ssh/authorized_keys 2>/dev/null
|
||||||
|
sudo chmod 600 /home/$username/.ssh/config 2>/dev/null
|
||||||
|
sudo chmod 644 /home/$username/.ssh/known_hosts 2>/dev/null
|
||||||
|
sudo chmod 644 /home/$username/.ssh/id_ed25519.pub 2>/dev/null
|
||||||
|
sudo chmod 600 /home/$username/.ssh/id_ed25519 2>/dev/null
|
||||||
+13
-13
@@ -6,13 +6,13 @@
|
|||||||
# handle defaultz
|
# handle defaultz
|
||||||
handle_args () {
|
handle_args () {
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
remote_host='pi3'
|
remote_host="pi3"
|
||||||
else
|
else
|
||||||
remote_host="$1"
|
remote_host="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $2 ]; then
|
if [ -z $2 ]; then
|
||||||
remote_dir='/var/www/html/Media-Viewer'
|
remote_dir="/var/www/html/Media-Viewer"
|
||||||
else
|
else
|
||||||
remote_dir="$2"
|
remote_dir="$2"
|
||||||
fi
|
fi
|
||||||
@@ -24,7 +24,7 @@ syncstatus () {
|
|||||||
git status
|
git status
|
||||||
|
|
||||||
echo -e "\nREMOTE status\n"
|
echo -e "\nREMOTE status\n"
|
||||||
ssh $remote_host "/bin/bash -c git -C $remote_dir status"
|
ssh $remote_host "/bin/bash -c \"git -C $remote_dir status\""
|
||||||
}
|
}
|
||||||
|
|
||||||
# synchronize git repos on local and remote
|
# synchronize git repos on local and remote
|
||||||
@@ -32,35 +32,35 @@ gitsync () {
|
|||||||
echo "INFO | Starting gitsync"
|
echo "INFO | Starting gitsync"
|
||||||
|
|
||||||
# run on remote
|
# run on remote
|
||||||
ssh $remote_host "git -C \"$remote_dir\" pull | tee -a \"$log_file\""
|
ssh $remote_host "git -C \"$remote_dir\" pull"
|
||||||
echo "REMOTE | Finished git pull on $remote_host:$remote_dir" $?
|
echo "REMOTE | Finished git pull on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" add . | tee -a \"$log_file\""
|
ssh $remote_host "git -C \"$remote_dir\" add ."
|
||||||
echo "REMOTE | Finished git adding on $remote_host:$remote_dir" $?
|
echo "REMOTE | Finished git adding on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" commit -m \"autosync at $(date +%s)\" | tee -a \"$log_file\""
|
ssh $remote_host "git -C \"$remote_dir\" commit -m \"autosync at $(date +%s)\""
|
||||||
echo "REMOTE | Finished git commit on $remote_host:$remote_dir" $?
|
echo "REMOTE | Finished git commit on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" push | tee -a \"$log_file\""
|
ssh $remote_host "git -C \"$remote_dir\" push"
|
||||||
echo "REMOTE | Finished git push on $remote_host:$remote_dir" $?
|
echo "REMOTE | Finished git push on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" status | tee -a \"$log_file\""
|
ssh $remote_host "git -C \"$remote_dir\" status"
|
||||||
echo "REMOTE | Finished git status on $remote_host:$remote_dir" $?
|
echo "REMOTE | Finished git status on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
# run on local
|
# run on local
|
||||||
git pull | tee -a "$log_file"
|
git pull
|
||||||
echo "LOCAL | Finished git pulling" $?
|
echo "LOCAL | Finished git pulling" $?
|
||||||
|
|
||||||
git add . | tee -a "$log_file"
|
git add .
|
||||||
echo "LOCAL | Finished git adding" $?
|
echo "LOCAL | Finished git adding" $?
|
||||||
|
|
||||||
git commit -m "autosync at $(date +%s)" | tee -a "$log_file"
|
git commit -m "autosync at $(date +%s)"
|
||||||
echo "LOCAL | Finished git comitting" $?
|
echo "LOCAL | Finished git comitting" $?
|
||||||
|
|
||||||
git push | tee -a "$log_file"
|
git push
|
||||||
echo "LOCAL | Finished git pushing" $?
|
echo "LOCAL | Finished git pushing" $?
|
||||||
|
|
||||||
git status | tee -a "$log_file"
|
git status
|
||||||
echo "LOCAL | Finished git status" $?
|
echo "LOCAL | Finished git status" $?
|
||||||
|
|
||||||
echo "INFO | Finished gitsync"
|
echo "INFO | Finished gitsync"
|
||||||
|
|||||||
Reference in New Issue
Block a user