mirror of
https://github.com/Snigdha-OS/snigdhaos-system-config.git
synced 2025-09-21 12:04:57 +02:00
@eshanized: push via push.sh!!!
This commit is contained in:
57
local/bin/snigdhaos-fix-pacman-conf
Normal file
57
local/bin/snigdhaos-fix-pacman-conf
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
#set -e
|
||||
|
||||
echo
|
||||
echo "Downloading Latest pacman.conf..."
|
||||
echo
|
||||
|
||||
Online=0
|
||||
file_boolean=0
|
||||
|
||||
function check_connectivity() {
|
||||
local test_ip
|
||||
local test_count
|
||||
|
||||
test_ip="172.217.12.110"
|
||||
test_count=1
|
||||
|
||||
if ping -c ${test_count} ${test_ip} > /dev/null; then
|
||||
echo "System Online!"
|
||||
Online=1
|
||||
else
|
||||
echo "System Offline!"
|
||||
Online=0
|
||||
fi
|
||||
}
|
||||
|
||||
function check_file() {
|
||||
file="/usr/local/share/snigdhaos/pacman.conf"
|
||||
if [[ -f $file ]];then
|
||||
echo $file " Found."
|
||||
file_boolean=1
|
||||
else
|
||||
echo $file " Not Found!"
|
||||
file_boolean=0
|
||||
fi
|
||||
}
|
||||
|
||||
check_connectivity
|
||||
check_file
|
||||
|
||||
if [ $Online -eq 1 ] ; then
|
||||
echo "Downloading pacman.conf..."
|
||||
sudo wget https://raw.githubusercontent.com/Snigdha-OS/snigdhaos-updater/master/pacman.conf -O $workdir/etc/pacman.conf
|
||||
fi
|
||||
|
||||
if [ $Online -eq 0 ] && [ $file_boolean -eq 1 ] ; then
|
||||
sudo cp /usr/local/share/snigdhaos/pacman.conf /etc/pacman.conf
|
||||
echo "Copied pacman.conf..."
|
||||
fi
|
||||
|
||||
if [ $Online -eq 0 ] && [ $file_boolean -eq 0 ] ; then
|
||||
echo "Run this script once you are back online!"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Task Completed!"
|
||||
echo
|
Reference in New Issue
Block a user