Files
chromebrew/packages/frp.rb
2025-11-07 23:40:57 +00:00

50 lines
1.7 KiB
Ruby

require 'package'
class Frp < Package
description 'A fast reverse proxy'
homepage 'https://github.com/fatedier/frp'
version '0.65.0'
license 'Apache-2.0'
compatibility 'aarch64 armv7l x86_64'
source_url({
aarch64: "https://github.com/fatedier/frp/releases/download/v#{version}/frp_#{version}_linux_arm.tar.gz",
armv7l: "https://github.com/fatedier/frp/releases/download/v#{version}/frp_#{version}_linux_arm.tar.gz",
x86_64: "https://github.com/fatedier/frp/releases/download/v#{version}/frp_#{version}_linux_amd64.tar.gz"
})
source_sha256({
aarch64: 'd4ffa465e038439eb165195c5e6b875bf712010cfe266761417025b416ed5118',
armv7l: 'd4ffa465e038439eb165195c5e6b875bf712010cfe266761417025b416ed5118',
x86_64: '52ced8c5fdf772f48a9909da4c10c7568c061861946ac9af7a86eeaf14b7e6d5'
})
no_compile_needed
def self.build
File.write 'frpc.sh', <<~EOF
#!/bin/bash
#{CREW_PREFIX}/share/frp/frpc -c #{CREW_PREFIX}/share/frp/frpc.toml "$@"
EOF
File.write 'frps.sh', <<~EOF
#!/bin/bash
#{CREW_PREFIX}/share/frp/frps -c #{CREW_PREFIX}/share/frp/frps.toml "$@"
EOF
end
def self.install
FileUtils.install 'frpc.sh', "#{CREW_DEST_PREFIX}/bin/frpc", mode: 0o755
FileUtils.install 'frps.sh', "#{CREW_DEST_PREFIX}/bin/frps", mode: 0o755
FileUtils.rm Dir['*.sh']
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/frp"
FileUtils.mv Dir['*'], "#{CREW_DEST_PREFIX}/share/frp"
end
def self.postinstall
ExitMessage.add <<~EOM
Type 'frps &' to start the server and run in the background.
Type 'frpc &' to start the client on another machine.
For more information, see https://github.com/fatedier/frp.
EOM
end
end