Add a command not found handler for Chromebrew (#11727)

* Add command-not-found package

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Suggested changes

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Add built packages for linux/386 to add_cmd_not_found_package

* Add built packages for linux/amd64 to add_cmd_not_found_package

* Add built packages for linux/arm/v7 to add_cmd_not_found_package

* Add sha256sum placeholder

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Add to packages.yaml

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Fix installation destination

Should be `CREW_DEST_PREFIX`

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>

* Add built packages for linux/386 to add_cmd_not_found_package

* Add built packages for linux/amd64 to add_cmd_not_found_package

* Add built packages for linux/arm/v7 to add_cmd_not_found_package

---------

Signed-off-by: SupeChicken666 <supechicken666@gmail.com>
Co-authored-by: supechicken <supechicken@users.noreply.github.com>
This commit is contained in:
SupeChicken666
2025-04-17 17:06:23 +08:00
committed by GitHub
parent 1180b81ce4
commit bd38436c84
6 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
/usr/local/bin/command-not-found-handler
/usr/local/etc/bash.d/03-command-not-found

View File

@@ -0,0 +1,2 @@
/usr/local/bin/command-not-found-handler
/usr/local/etc/bash.d/03-command-not-found

View File

@@ -0,0 +1,2 @@
/usr/local/bin/command-not-found-handler
/usr/local/etc/bash.d/03-command-not-found

View File

@@ -0,0 +1,33 @@
require 'package'
class Command_not_found < Package
description 'Show suggestions for non-installed commands'
homepage 'https://github.com/chromebrew/command-not-found'
version '0.1'
license 'GPL-3'
compatibility 'all'
source_url 'https://github.com/supechicken/crew-command-not-found.git'
git_hashtag version
binary_compression 'tar.zst'
binary_sha256({
aarch64: '7f8de55deb147596cac8c0fd518de614fb509ce0e7492e7592f13b69ce94e6a3',
armv7l: '7f8de55deb147596cac8c0fd518de614fb509ce0e7492e7592f13b69ce94e6a3',
i686: '775b86ef37ac0e7f541af095d939063c4dcd2512e330a88aab7846a9f6e80c47',
x86_64: '4e1bc306c0e7995946c5f0d219a35a2e4115bee31914a242cff479a4cc5360d4'
})
depends_on 'glibc' # R
print_source_bashrc
def self.build
system "mold -run cc #{CREW_COMMON_FLAGS} command-not-found-handler.c -o command-not-found-handler"
end
def self.install
FileUtils.mkdir_p %W[#{CREW_DEST_PREFIX}/bin #{CREW_DEST_PREFIX}/etc/bash.d]
FileUtils.install 'command-not-found-handler', "#{CREW_DEST_PREFIX}/bin/command-not-found-handler", mode: 0o755
FileUtils.install 'command-not-found.sh', "#{CREW_DEST_PREFIX}/etc/bash.d/03-command-not-found", mode: 0o644
end
end

View File

@@ -3,7 +3,7 @@ require 'package'
class Core < Package
description 'Core Chromebrew Packages.'
homepage 'https://github.com/chromebrew/chromebrew'
version '3.5'
version '3.6'
license 'GPL-3+'
compatibility 'all'
@@ -15,6 +15,7 @@ class Core < Package
depends_on 'bzip2'
depends_on 'c_ares'
depends_on 'ca_certificates'
depends_on 'command_not_found'
depends_on 'crew_mvdir'
depends_on 'crew_profile_base'
depends_on 'crew_sudo' if CHROMEOS_RELEASE.to_i > 116

View File

@@ -1120,6 +1120,11 @@ url: https://github.com/shyiko/commacd/releases
activity: low
---
kind: url
name: command_not_found
url: https://github.com/chromebrew/command-not-found
activity: medium
---
kind: url
name: composer
url: https://github.com/composer/composer/releases
activity: medium