Used to check the minimal requirment to compile the kernel which are declared in below sites:
https://www.kernel.org/doc/html/v4.15/process/changes.html
Program:
# Kernel minimal requriment check by Velraj.K
# Check : http://velrajcoding.blogspot.in
import subprocess
import shutil
import os
APT_INSTALL_COMMAND = "sudo apt-get --assume-yes install "
APT_UPDATE = "sudo apt update --assume-yes"
DICT_NAME = 'name'
DICT_CMD = 'command'
existing_sofware = []
not_available_list = []
installing_err = []
def is_tool_present(name):
# var = os.system('which vim') will display the output on console and store success value 0 to var
# store the output of which in command line value into the var.
var = os.popen('which ' + name).read()
ret = var.find(name)
return ret != -1
def install_software(software):
# Check the command is present in Linux OS
if is_tool_present(software[DICT_CMD]):
existing_sofware.append(software)
else:
not_available_list.append(software)
https://www.kernel.org/doc/html/v4.15/process/changes.html
Program:
# Kernel minimal requriment check by Velraj.K
# Check : http://velrajcoding.blogspot.in
import subprocess
import shutil
import os
APT_INSTALL_COMMAND = "sudo apt-get --assume-yes install "
APT_UPDATE = "sudo apt update --assume-yes"
DICT_NAME = 'name'
DICT_CMD = 'command'
existing_sofware = []
not_available_list = []
installing_err = []
def is_tool_present(name):
# var = os.system('which vim') will display the output on console and store success value 0 to var
# store the output of which in command line value into the var.
var = os.popen('which ' + name).read()
ret = var.find(name)
return ret != -1
def install_software(software):
# Check the command is present in Linux OS
if is_tool_present(software[DICT_CMD]):
existing_sofware.append(software)
else:
not_available_list.append(software)
# Display the table header.
def table_header():
# The value 1,20,25 & 20 are constant based on the column name
print "{:<20} {:<15} {:<20} {:<20}".format('Program Name', '\"Command\"', '\"Available\"', '\"Not available\"')
line = []
for i in range(1, 72):
# creat the list with - for display a line
line.append('-')
# convert the list into a string other wise display as ['-', '-', '-', ...]
str1 = ''.join(str(e) for e in line)
print str1
# To display the row content in the table
def table_row(table_row):
# The value 22, 23,23 & 20 are constant based on the column adjust value row
print "{:<23} {:<15} {:<21} {:<20}".format(table_row[0], table_row[1], table_row[2], table_row[3])
def result_tablular():
# Display the result table header
table_header()
# Display the row value in the tabl
for name in existing_sofware:
table_row([name[DICT_NAME], name[DICT_CMD], 'Yes', 'NA'])
for name in not_available_list:
table_row([name[DICT_NAME], name[DICT_CMD], 'NA', 'Yes'])
def main():
# Dictionary usage example:
# myStruct = {'field1': 'some val', 'field2': 'some val'}
# print myStruct['field1']
# myStruct['field2'] = 'some other values'
# List of Minimum requirement package
dict_list_software = [ {DICT_NAME:'GNU C', DICT_CMD:'gcc'},
{DICT_NAME:'GNU make', DICT_CMD:'make'},
{DICT_NAME:'binutils', DICT_CMD:'ld'},
{DICT_NAME:'util-linux', DICT_CMD:'fdformat'},
{DICT_NAME:'module-init-tools', DICT_CMD:'depmod'},
{DICT_NAME:'e2fsprogs', DICT_CMD:'e2fsck'},
{DICT_NAME:'jfsutils', DICT_CMD:'fsck.jfs'},
{DICT_NAME:'reiserfsprogs', DICT_CMD:'reiserfsck'},
{DICT_NAME:'xfsprogs', DICT_CMD:'xfs_db'},
{DICT_NAME:'squashfs-tools', DICT_CMD:'mksquashfs'},
{DICT_NAME:'btrfs-progs', DICT_CMD:'btrfsck'},
{DICT_NAME:'pcmciautils', DICT_CMD:'pccardctl'},
{DICT_NAME:'quota-tools', DICT_CMD:'quota'},
{DICT_NAME:'PPP', DICT_CMD:'pppd'},
{DICT_NAME:'isdn4k-utils', DICT_CMD:'isdnctrl'},
{DICT_NAME:'nfs-utils', DICT_CMD:'showmount'},
{DICT_NAME:'procps', DICT_CMD:'ps'},
{DICT_NAME:'oprofile', DICT_CMD:'oprofiled'},
{DICT_NAME:'udev', DICT_CMD:'udevd'},
{DICT_NAME:'grub', DICT_CMD:'grub'},
{DICT_NAME:'mcelog', DICT_CMD:'mcelog'},
{DICT_NAME:'iptables', DICT_CMD:'iptables'},
{DICT_NAME:'openssl & libcrypto', DICT_CMD:'openssl'},
{DICT_NAME:'bc', DICT_CMD:'bc'},
{DICT_NAME:'Sphinx', DICT_CMD:'sphinx-build'} ]
# Check and install the list of software available in the software_name
for name in dict_list_software:
install_software(name)
result_tablular()
if __name__ == "__main__":
main()
No comments:
Post a Comment