diff --git a/client/modules/selfUpdater.mjs b/client/modules/selfUpdater.mjs index a9e2799..6769c76 100644 --- a/client/modules/selfUpdater.mjs +++ b/client/modules/selfUpdater.mjs @@ -1,5 +1,6 @@ import simpleGit from 'simple-git'; import { restartService } from './serviceHandler.mjs' +import { launchProcess } from './subprocessHandler.mjs' const git = simpleGit(); @@ -24,13 +25,18 @@ export const checkForUpdates = async () => { if (gitStatus.modified.length > 0){ // There is locally modified code console.log("There is locally modified code, resetting..."); - await git.reset('hard', ['origin/master']) + await git.stash(); + await git.reset('hard', ['origin/master']); } // Pull the latest changes from the remote repository await git.pull(); console.log('Update completed successfully. Restarting the application...'); + + // Run the post-update script + await launchProcess("bash", ['./post-update.sh']); + // Restart the application to apply the updates restartApplication(); return true diff --git a/client/post-update.sh b/client/post-update.sh new file mode 100644 index 0000000..adc964d --- /dev/null +++ b/client/post-update.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +npm install \ No newline at end of file