Skip to content

Commit

Permalink
fix: apt options
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Apr 13, 2024
1 parent eeaec35 commit 97a28cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/apt.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ export default class {
return result( 200 );
}

async update () {
async update ( { deleteOldPackages } = {} ) {
var res;

res = this.installDeps();
if ( !res.ok ) return res;

res = this.#deleteOldPackages();
if ( !res.ok ) return res;
if ( deleteOldPackages ) {
res = this.#deleteOldPackages();
if ( !res.ok ) return res;
}

for ( const codename of this.#getCodenames().data ) {
fs.mkdirSync( this.root + `/dists/${ codename }/${ this.config.component }/binary-all`, {
Expand Down
16 changes: 14 additions & 2 deletions lib/commands/apt/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ export default class extends Command {

// static
static cli () {
return;
return {
"options": {
"delete-old-packages": {
"description": "delete old packages versions",
"default": false,
"schema": {
"type": "boolean",
},
},
},
};
}

// public
Expand All @@ -19,6 +29,8 @@ export default class extends Command {
const res = apt.checkRepository();
if ( !res.ok ) return res;

return apt.update();
return apt.update( {
"deleteOldPackages": process.cli.options[ "delete-old-packages" ],
} );
}
}

0 comments on commit 97a28cd

Please sign in to comment.