Skip to content

Commit 96dd6b7

Browse files
committed
Added functions to generate the kernel
1 parent bfe42f0 commit 96dd6b7

File tree

6 files changed

+60
-113
lines changed

6 files changed

+60
-113
lines changed

ISM/CommandLine.cr

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module ISM
55
property systemInformation : ISM::CommandLineSystemInformation
66
property requestedSoftwares : Array(ISM::SoftwareInformation)
77
property neededKernelOptions : Array(ISM::NeededKernelOption)
8-
property unneededKernelOptions : Array(ISM::UnneededKernelOption)
98
property options : Array(ISM::CommandLineOption)
109
property settings : ISM::CommandLineSettings
1110
property kernels : Array(ISM::AvailableKernel)
@@ -25,7 +24,6 @@ module ISM
2524
@systemInformation = ISM::CommandLineSystemInformation.new
2625
@requestedSoftwares = Array(ISM::SoftwareInformation).new
2726
@neededKernelOptions = Array(ISM::NeededKernelOption).new
28-
@unneededKernelOptions = Array(ISM::UnneededKernelOption).new
2927
@calculationStartingTime = Time.monotonic
3028
@frameIndex = 0
3129
@reverseAnimation = false
@@ -74,7 +72,6 @@ module ISM
7472
loadSystemInformationFile
7573
loadKernelOptionDatabase
7674
loadNeededKernelOptions
77-
loadUnneededKernelOptions
7875
loadSoftwareDatabase
7976
loadInstalledSoftwareDatabase
8077
loadPortsDatabase
@@ -101,24 +98,6 @@ module ISM
10198
exitProgram
10299
end
103100

104-
def loadUnneededKernelOptions
105-
if !Dir.exists?(@settings.rootPath+ISM::Default::Path::UnneededKernelOptionsDirectory)
106-
Dir.mkdir_p(@settings.rootPath+ISM::Default::Path::UnneededKernelOptionsDirectory)
107-
end
108-
109-
unneededKernelOptions = Dir.children(@settings.rootPath+ISM::Default::Path::UnneededKernelOptionsDirectory)
110-
111-
unneededKernelOptions.each do |option|
112-
113-
@unneededKernelOptions << ISM::UnneededKernelOption.loadConfiguration(@settings.rootPath+ISM::Default::Path::UnneededKernelOptionsDirectory+"/"+option)
114-
115-
end
116-
117-
rescue error
118-
printSystemCallErrorNotification(error)
119-
exitProgram
120-
end
121-
122101
def loadKernelOptionDatabase
123102
if !Dir.exists?(@settings.rootPath+ISM::Default::Path::KernelOptionsDirectory)
124103
Dir.mkdir_p(@settings.rootPath+ISM::Default::Path::KernelOptionsDirectory)
@@ -1025,16 +1004,6 @@ module ISM
10251004
exitProgram
10261005
end
10271006

1028-
def notifyOfRecordUnneededKernelOptions(softwareInformation : ISM::SoftwareInformation)
1029-
kernelName = (selectedKernel.name == "" ? ISM::Default::CommandLine::FuturKernelText : selectedKernel.name )
1030-
1031-
printProcessNotification(ISM::Default::CommandLine::RecordUnneededKernelOptionsText+"#{kernelName.colorize(:green)}")
1032-
1033-
rescue error
1034-
printSystemCallErrorNotification(error)
1035-
exitProgram
1036-
end
1037-
10381007
def notifyOfUninstall(softwareInformation : ISM::SoftwareInformation)
10391008
printProcessNotification(ISM::Default::CommandLine::UninstallText+"#{softwareInformation.name.colorize(:green)}")
10401009

@@ -2213,7 +2182,6 @@ module ISM
22132182
Ism.showStartSoftwareUninstallingMessage(index, limit, port, name, version)
22142183
22152184
begin
2216-
target.recordUnneededKernelOptions
22172185
target.uninstall
22182186
rescue error
22192187
Ism.printSystemCallErrorNotification(error)
@@ -2596,31 +2564,6 @@ module ISM
25962564
exitProgram
25972565
end
25982566

2599-
def getRequiredKernelOptions
2600-
neededOptions = Hash(String,ISM::KernelOption).new
2601-
buildAsModule = Hash(String,Bool).new
2602-
choiceSolved = Hash(String,Bool).new
2603-
blockerSolved = Hash(String,Bool).new
2604-
2605-
#1 - We perform a first pass to record the options that don't need any special requirements
2606-
@neededKernelOptions.each do |option|
2607-
2608-
if option.singleChoiceDependencies.empty? && option.blockers.empty?
2609-
neededOptions[option.name] = options
2610-
buildAsModule[option.name] = (option.tristate && @settings.buildKernelOptionsAsModule ? true : false)
2611-
choiceSolved[option.name] = true
2612-
blockerSolved[option.name] = true
2613-
end
2614-
2615-
end
2616-
2617-
#return
2618-
2619-
rescue error
2620-
printSystemCallErrorNotification(error)
2621-
exitProgram
2622-
end
2623-
26242567
def generateTasksFile(tasks : String)
26252568
File.write("#{@settings.rootPath}#{ISM::Default::Path::RuntimeDataDirectory}#{ISM::Default::Filename::Task}.cr", tasks)
26262569

@@ -2899,6 +2842,31 @@ module ISM
28992842
exitProgram
29002843
end
29012844

2845+
def getNeededKernelOptions : Array(ISM::NeededKernelOption)
2846+
neededOptions = Hash(String,ISM::KernelOption).new
2847+
buildAsModule = Hash(String,Bool).new
2848+
choiceSolved = Hash(String,Bool).new
2849+
blockerSolved = Hash(String,Bool).new
2850+
2851+
#1 - We perform a first pass to record the options that don't need any special requirements
2852+
@neededKernelOptions.each do |option|
2853+
2854+
if option.singleChoiceDependencies.empty? && option.blockers.empty?
2855+
neededOptions[option.name] = options
2856+
buildAsModule[option.name] = (option.tristate && @settings.buildKernelOptionsAsModule ? true : false)
2857+
choiceSolved[option.name] = true
2858+
blockerSolved[option.name] = true
2859+
end
2860+
2861+
end
2862+
2863+
#return
2864+
2865+
rescue error
2866+
printSystemCallErrorNotification(error)
2867+
exitProgram
2868+
end
2869+
29022870
def generateDefaultKernelConfig
29032871
requestedCommands = "make #{@settings.systemMakeOptions} defconfig"
29042872
path = kernelSourcesPath
@@ -2915,8 +2883,41 @@ module ISM
29152883
exitProgram
29162884
end
29172885

2918-
#GERER LE CAS OU LE NOYAU N'EST PAS INSTALLE
2919-
#COMMENT GERER SI UNE FEATURE AVAIT DES DEPENDANCES LORS DE LA DESINSTALLATION ?
2886+
def generateKernelConfig
2887+
2888+
end
2889+
2890+
def generateKernel
2891+
requestedCommands = "make #{@settings.systemMakeOptions} mrproper && make #{@settings.systemMakeOptions} modules_prepare && make #{@settings.systemMakeOptions} && make #{@settings.systemMakeOptions} modules_install && make #{@settings.systemMakeOptions} install"
2892+
path = kernelSourcesPath
2893+
2894+
process = runSystemCommand(requestedCommands, path)
2895+
2896+
if !process.success?
2897+
notifyOfRunSystemCommandError(requestedCommands, path)
2898+
exitProgram
2899+
end
2900+
2901+
rescue error
2902+
printSystemCallErrorNotification(error)
2903+
exitProgram
2904+
end
2905+
2906+
def installKernel
2907+
requestedCommands = "mv System.map /boot/System.map-linux-#{mainKernelVersion} && mv vmlinuz /boot/vmlinuz-linux-#{mainKernelVersion} && cp .config /boot/config-linux-#{mainKernelVersion}"
2908+
path = kernelSourcesPath
2909+
2910+
process = runSystemCommand(requestedCommands, path)
2911+
2912+
if !process.success?
2913+
notifyOfRunSystemCommandError(requestedCommands, path)
2914+
exitProgram
2915+
end
2916+
2917+
rescue error
2918+
printSystemCallErrorNotification(error)
2919+
exitProgram
2920+
end
29202921

29212922
def mainKernelName : String
29222923
return selectedKernel.versionName.downcase

ISM/Default/CommandLine.cr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ module ISM
3838
CleanText = "Cleaning "
3939
FuturKernelText = "future kernel (not installed yet)"
4040
UpdateKernelOptionsDatabaseText = "Updating kernel options database for "
41-
RecordUnneededKernelOptionsText = "Recording unneeded kernel options for "
4241
UninstallText = "Uninstalling "
4342
ErrorDownloadText = "Failed to download from "
4443
ErrorConnexionText1 = "Failed to connect to "

ISM/Default/Path.cr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module ISM
1616
PortsDirectory = "#{RuntimeDataDirectory}ports/"
1717
KernelOptionsDirectory = "#{RuntimeDataDirectory}kerneloptions/"
1818
NeededKernelOptionsDirectory = "#{RuntimeDataDirectory}neededkerneloptions/"
19-
UnneededKernelOptionsDirectory = "#{RuntimeDataDirectory}unneededkerneloptions/"
2019
SoftwaresDirectory = "#{RuntimeDataDirectory}softwares/"
2120
InstalledSoftwaresDirectory = "#{RuntimeDataDirectory}installedsoftwares/"
2221
SettingsSoftwaresDirectory = "#{SettingsDirectory}softwares/"

ISM/Software.cr

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,14 +1793,6 @@ module ISM
17931793
Ism.exitProgram
17941794
end
17951795

1796-
def recordUnneededKernelOptions
1797-
Ism.notifyOfRecordUnneededKernelOptions(@information)
1798-
1799-
rescue error
1800-
Ism.printSystemCallErrorNotification(error)
1801-
Ism.exitProgram
1802-
end
1803-
18041796
def showInformations
18051797
puts
18061798
Ism.printInformationNotificationTitle(@information.name,@information.version)

ISM/UnneededKernelOption.cr

Lines changed: 0 additions & 42 deletions
This file was deleted.

RequiredLibraries.cr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ require "./ISM/CommandLinePortsSettings"
1515
require "./ISM/CommandLineMirrorsSettings"
1616
require "./ISM/KernelOption"
1717
require "./ISM/NeededKernelOption"
18-
require "./ISM/UnneededKernelOption"
1918
require "./ISM/Mirror"
2019
require "./ISM/Port"
2120
require "./ISM/SoftwareDependency"
@@ -40,7 +39,6 @@ require "./ISM/Default/CommandLineMirrorsSettings"
4039
require "./ISM/Default/Filename"
4140
require "./ISM/Default/KernelOption"
4241
require "./ISM/Default/NeededKernelOption"
43-
require "./ISM/Default/UnneededKernelOption"
4442
require "./ISM/Default/Mirror"
4543
require "./ISM/Default/Path"
4644
require "./ISM/Default/Software"

0 commit comments

Comments
 (0)