uls.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Universal-Linux-Script 作者: CYRO4S 项目源码 文件源码
def Update():

    # Check for ROOT
    # If "uls --update" is not run as ROOT, notify user & exit.
    print('Checking for ROOT...')
    if os.geteuid() != 0:
        print("ERR_1005: 'uls --update' must be run as ROOT. Use 'sudo uls --update' instead.")
        exit(1005)

    # Check for Internet connection before update
    print('Checking for Internet connection...')
    rPing = os.popen("ping -c 3 raw.githubusercontent.com | grep '0 received' | wc -l")
    strPing = rPing.read().strip('\n')
    rPing.close()

    # If Internet is unavailable, exit.
    if strPing == '1':
        print('ERR_1003: Internet is unavailable. Check your connection before running update.')
        exit(1003)

    # Now, do the update 
    os.system("wget --no-check-certificate -O /usr/share/uls/uls_update.sh https://raw.githubusercontent.com/CYRO4S/Universal-Linux-Script/master/uls_update.sh && bash /usr/share/uls/uls_update.sh")
    exit(0)

# Echo
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号