资源简介
Linux 12.04 版本备份
代码片段和文件信息
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 作者: ptptptptptpt < ptptptptptpt@163.com >
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not write to the Free Software
# Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
#
import os
import sys
import commands
import time
import signal
def check_package_install( pkg_name ):
a = commands.getoutput( ‘dpkg -l‘ )
a = a.split( ‘\n‘ )
for each in a:
if each[0:2] == ‘ii‘ and each.split()[1] == pkg_name:
return True
return False
def check_target_partitions( MountPointsConf swap_part cn_or_en ):
# 是否指定了 / 分区
if not ( ‘/‘ in MountPointsConf.keys() ):
if cn_or_en == ‘cn‘:
return [ 1 ‘错误:未指定 / 分区。\n‘ ]
else:
return [ 1 ‘Error: root partition is unspecified.\n‘ ]
# 检查各挂载点的分区是否冲突
for each_mp in MountPointsConf:
for each_mp2 in MountPointsConf:
if MountPointsConf[each_mp][‘part‘] == MountPointsConf[each_mp2][‘part‘] and each_mp2 != each_mp :
if cn_or_en == ‘cn‘:
return (2 ‘错误: %s 被同时指定到 “%s“ and “%s“.\n‘ %( MountPointsConf[each_mp][‘part‘] each_mp each_mp2) )
else:
return (2 ‘Error: %s is assigned repeatedly to “%s“ and “%s“.\n‘ %( MountPointsConf[each_mp][‘part‘] each_mp each_mp2) )
for each_mp in MountPointsConf:
if swap_part == MountPointsConf[each_mp][‘part‘]:
if cn_or_en == ‘cn‘:
return [ 3 ‘错误:%s 被同时指定为 “%s“ 和 交换分区。\n‘%( MountPointsConf[each_mp][‘part‘] each_mp ) ]
else:
return [ 3 ‘Error: %s is assigned repeatedly to “%s“ and swap.\n‘%( MountPointsConf[each_mp][‘part‘] each_mp ) ]
# 检查用于各分区的文件系统
SupportFilesystems = ( ‘current‘ ‘ext2‘ ‘ext3‘ ‘ext4‘ ‘reiserfs‘ ‘jfs‘ ‘xfs‘ )
for each_mp in MountPointsConf:
if not MountPointsConf[each_mp][‘fs‘]:
if cn_or_en == ‘cn‘:
return [ 4 ‘错误:未指定用于 “‘ + each_mp + ‘“ 的文件系统。\n‘ ]
else:
return [ 4 ‘Error: filesystem for “‘ + each_mp + ‘“ is unspecified.\n‘ ]
elif not ( MountPointsConf[each_mp][‘fs‘] in SupportFilesystems ):
if cn_or_en == ‘cn‘:
return [ 5 ‘错误:不支持 “‘ + MountPointsConf[each_mp][‘fs‘] + ‘“ 文件系统。‘ +
‘\n可选文件系统:‘ + ‘ ‘.joi
- 上一篇:cadence 17.0 网盘链接
- 下一篇:VRP问题蚁群算法
相关资源
- linux libgcc_s.so.1 libgcc_s-4.4.5-20110214.
- uClinux-dist-20070130.tar.tar
- linux 实验7
- Linux iptables防火墙深度理解与实战应用
- makefile实验——华农Linux实验8
- quartus_II_13.1链接
- zw_(linuxc)linux进程监控和进程守护程
- linux 下的无线点菜系统
- libxl注册机源码支持window和linux
- linux操作系统实验二
- Linux基线修复
- wiegand维根协议驱动程序
- linux内核中断
- Linux课程设计—基于服务器的文件共享
- 英特尔集成显卡及核心显卡Intel(R)
- jdk-7u67-linux-x64.tar.gz
- Intel Parallel Studio XE 2018 Update 1 Windows
- Linux下的Socket聊天系统,QT完整界面
- Linux下的QT车牌识别门禁系统基于ope
- SElinux详细讲解
- Linux下使用UDP协议的点对点聊天程序含
- Linux系统自动不停重启并计数的shell脚
- ov9650摄像头在qt中的实现代码
- 将游戏手柄按键映射到键盘
- linux下tuxedo服务器安装与配置
- 华清远见uboot和linux内核移植实验手册
- linux外文翻译内含中英文
- 暴包括51,stm32,LINUXs三种和美的空调
- 基于Linux的模拟进程调度算法
- GCC中文手册 中国linux论坛man手册翻译
评论
共有 条评论