Commit c2058cbb6a4078c0c429aea47b0fecbea6576fb8

Thomas de Grivel 2023-02-21T19:52:28

installed

diff --git a/bin/rbpkg b/bin/rbpkg
index b3382e7..005ec59 100755
--- a/bin/rbpkg
+++ b/bin/rbpkg
@@ -29,14 +29,14 @@ Build commands :
 Package commands : 
  fake             install into fake installation directory
  clean-fake       remove fake installation directory
- package         .build package
+ package          build package
  clean-package    remove package file
- install         -install package
- uninstall       -uninstall package
+ install         .install package
+ uninstall       .uninstall package
 
 Misc commands :
  clean-all        clean all files
- info            -show information
+ info             show information
 """
   exit 1
 end
@@ -85,6 +85,12 @@ def rbpkg
     Rbpkg.package($ARGS)
   when "clean-package"
     Rbpkg.clean_package($ARGS)
+  when "clean-package"
+    Rbpkg.clean_package($ARGS)
+  when "install"
+    Rbpkg.install($ARGS)
+  when "uninstall"
+    Rbpkg.uninstall($ARGS)
   when "clean-all"
     Rbpkg.clean_all($ARGS)
   when "info"
diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index f71a490..e418720 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -140,6 +140,16 @@ module Rbpkg
 }"""
   end
 
+  def self.install(repos)
+    repos.each do |name|
+      Repos.repo(name).install()
+    end
+  end
+
+  def self.installed_dir
+    "#{dir}/var/db/installed"
+  end
+
   def self.lock(name)
     path = lock_path(name)
     #verbose(2, "Locking #{path}")
@@ -229,6 +239,12 @@ module Rbpkg
       Repos.repo(name).test()
     end
   end
+
+  def self.uninstall(repos)
+    repos.each do |name|
+      Repos.repo(name).uninstall()
+    end
+  end
 end
 
 def cmd(string)
diff --git a/lib/rbpkg/repo.rb b/lib/rbpkg/repo.rb
index efda07d..d756a44 100644
--- a/lib/rbpkg/repo.rb
+++ b/lib/rbpkg/repo.rb
@@ -185,6 +185,18 @@ class Rbpkg::Repo
 }"""
   end
 
+  def install
+    
+  end
+
+  def installed
+    "#{Rbpkg.installed_dir}/#{dir}"
+  end
+
+  def installed?
+    File.file?(installed)
+  end
+
   def name
     self.class.name.to_s.downcase.scan(/::([^:]*)$/)[0][0]
   end
@@ -303,6 +315,10 @@ class Rbpkg::Repo
     "test"
   end
 
+  def uninstall
+    
+  end
+
   def version
     if File.directory?(src_dir)
       "#{head}-#{hash}"