src/Pure/System/linux.scala
changeset 71327 a89729bdde89
parent 71280 5a2033fc8f3d
child 71726 a5fda30edae2
equal deleted inserted replaced
71326:d85258458623 71327:a89729bdde89
    69 
    69 
    70   def package_install(packages: List[String], progress: Progress = No_Progress): Unit =
    70   def package_install(packages: List[String], progress: Progress = No_Progress): Unit =
    71     progress.bash("apt-get install -y -- " + Bash.strings(packages), echo = true).check
    71     progress.bash("apt-get install -y -- " + Bash.strings(packages), echo = true).check
    72 
    72 
    73   def package_installed(name: String): Boolean =
    73   def package_installed(name: String): Boolean =
    74     Isabelle_System.bash("dpkg-query -s " + Bash.string(name)).ok
    74   {
       
    75     val result = Isabelle_System.bash("dpkg-query -s " + Bash.string(name))
       
    76     val pattern = """^Status:.*installed.*$""".r.pattern
       
    77     result.ok && result.out_lines.exists(line => pattern.matcher(line).matches)
       
    78   }
    75 
    79 
    76 
    80 
    77   /* users */
    81   /* users */
    78 
    82 
    79   def user_exists(name: String): Boolean =
    83   def user_exists(name: String): Boolean =