add update_file_sudo
This commit is contained in:
parent
f80450f01a
commit
ca38324790
15
update.sh
15
update.sh
@ -14,6 +14,16 @@ update_file() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_file_sudo() {
|
||||||
|
local A="$1"
|
||||||
|
local B="$2"
|
||||||
|
|
||||||
|
if [ -f "$A" ] && [ -f "$B" ] && [ "$(cat "$A")" != "$(cat "$B")" ]; then
|
||||||
|
sudo cp "$A" "$B"
|
||||||
|
echo "File $B has been updated."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
update_authorized_keys() {
|
update_authorized_keys() {
|
||||||
[ ! -f ~/.ssh/authorized_keys ] && return
|
[ ! -f ~/.ssh/authorized_keys ] && return
|
||||||
|
|
||||||
@ -40,3 +50,8 @@ update_file $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/80-p
|
|||||||
update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh
|
update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh
|
||||||
update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme
|
update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme
|
||||||
update_authorized_keys
|
update_authorized_keys
|
||||||
|
|
||||||
|
sudo_id=$(sudo id -u 2>/dev/null)
|
||||||
|
if [ $? -eq 0 ] && [ "$sudo_id" -eq 0 ]; then
|
||||||
|
update_file_sudo $scriptdir/files/proxychains4.conf /etc/proxychains4.conf
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user