diff --git a/app/llama.cpp b/app/llama.cpp index 30b09f9ef..c4578ea53 100644 --- a/app/llama.cpp +++ b/app/llama.cpp @@ -20,16 +20,21 @@ int llama_fit_params(int argc, char ** argv); int llama_quantize(int argc, char ** argv); int llama_perplexity(int argc, char ** argv); -// hands the update over to the install script, which downloads and swaps the binary +// Self-update is only supported for binaries built with llama-install.sh static int llama_update(int argc, char ** argv) { (void) argc; (void) argv; +#ifdef LLAMA_INSTALL_BUILD #if defined(_WIN32) return system("powershell -NoProfile -ExecutionPolicy Bypass -Command \"irm https://llama.app/install.ps1 | iex\""); #else return system("curl -fsSL https://llama.app/install.sh | sh"); #endif +#else + printf("Updates are available only when installed from https://llama.app\n"); + return 1; +#endif } static const char * progname; @@ -46,21 +51,29 @@ struct command { int (*func)(int, char **); }; +#ifdef LLAMA_INSTALL_BUILD +#define UPDATE_HIDDEN false +#else +#define UPDATE_HIDDEN true +#endif + static const command cmds[] = { - {"serve", "HTTP API server", {"server"}, false, llama_server }, - {"cli", "Command-line interactive interface", {"client"}, false, llama_cli }, - {"update", "Update llama to the latest release", {}, false, llama_update }, - {"completion", "Text completion", {"complete"}, true, llama_completion }, - {"bench", "Benchmark prompt processing and text generation", {}, true, llama_bench }, - {"batched-bench", "Benchmark batched decoding performance", {}, true, llama_batched_bench}, - {"fit-params", "Compute parameters to fit a model in device memory", {}, true, llama_fit_params }, - {"quantize", "Quantize a model", {}, true, llama_quantize }, - {"perplexity", "Compute model perplexity and KL divergence", {}, true, llama_perplexity }, - {"version", "Show version", {}, false, version }, - {"licenses", "Show third-party licenses", {"credits"}, false, licenses }, - {"help", "Show available commands", {}, false, help }, + {"serve", "HTTP API server", {"server"}, false, llama_server }, + {"cli", "Command-line interactive interface", {"client"}, false, llama_cli }, + {"update", "Update llama to the latest release", {}, UPDATE_HIDDEN, llama_update }, + {"completion", "Text completion", {"complete"}, true, llama_completion }, + {"bench", "Benchmark prompt processing and text generation", {}, true, llama_bench }, + {"batched-bench", "Benchmark batched decoding performance", {}, true, llama_batched_bench}, + {"fit-params", "Compute parameters to fit a model in device memory", {}, true, llama_fit_params }, + {"quantize", "Quantize a model", {}, true, llama_quantize }, + {"perplexity", "Compute model perplexity and KL divergence", {}, true, llama_perplexity }, + {"version", "Show version", {}, false, version }, + {"licenses", "Show third-party licenses", {"credits"}, false, licenses }, + {"help", "Show available commands", {}, false, help }, }; +#undef UPDATE_HIDDEN + static int version(int argc, char ** argv) { printf("%s\n", llama_build_info()); return 0;