# All files update.ts

58.33% Statements 7/12
0% Branches 0/3
0% Functions 0/1
70% Lines 7/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    282x
    2x
    2x
    2x
    2x

    2x

    2x
     import { defaultExecOptions, execRootSync } from "admina"
    import memoize from "memoizee"
    import { getAptEnv } from "./apt-env.js"
    import { aptTimeout } from "./apt-timeout.js"
    import { getApt } from "./get-apt.js"

    export let updatedRepos = false // eslint-disable-line import/no-mutable-exports

    /**
     * Update the apt repositories
     * @param apt The apt command to use (optional)
     */
    export function updateAptRepos(apt: string = getApt()) {
      execRootSync(
        apt,
        apt !== "nala" ? ["update", "-y", "-o", aptTimeout] : ["update", "-o", aptTimeout],
        { ...defaultExecOptions, env: getAptEnv(apt) },
      )

      updatedRepos = true
    }

    /**
     * Update the apt repositories (memoized)
     * @param apt The apt command to use (optional)
     */
    export const updateAptReposMemoized = memoize(updateAptRepos)