mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 10:36:07 +00:00
feat: update Arch Linux script to use yay for package management and install yay if missing
This commit is contained in:
@@ -2,7 +2,7 @@ import { SelectedPackage, Platform, GeneratedScript } from '@/types'
|
|||||||
|
|
||||||
export function generateScript(packages: SelectedPackage[], platform: Platform): GeneratedScript {
|
export function generateScript(packages: SelectedPackage[], platform: Platform): GeneratedScript {
|
||||||
const script = createScriptContent(packages, platform)
|
const script = createScriptContent(packages, platform)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
platform: platform.id,
|
platform: platform.id,
|
||||||
script,
|
script,
|
||||||
@@ -31,7 +31,7 @@ function createScriptContent(packages: SelectedPackage[], platform: Platform): s
|
|||||||
|
|
||||||
function generateDebianBasedScript(packages: SelectedPackage[], platformName: string): string {
|
function generateDebianBasedScript(packages: SelectedPackage[], platformName: string): string {
|
||||||
const packageNames = packages.map(p => p.name).join(' ')
|
const packageNames = packages.map(p => p.name).join(' ')
|
||||||
|
|
||||||
return `#!/bin/bash
|
return `#!/bin/bash
|
||||||
|
|
||||||
# RepoHub Installation Script for ${platformName}
|
# RepoHub Installation Script for ${platformName}
|
||||||
@@ -65,7 +65,7 @@ echo "Installation completed!"`
|
|||||||
|
|
||||||
function generateFedoraScript(packages: SelectedPackage[]): string {
|
function generateFedoraScript(packages: SelectedPackage[]): string {
|
||||||
const packageNames = packages.map(p => p.name).join(' ')
|
const packageNames = packages.map(p => p.name).join(' ')
|
||||||
|
|
||||||
return `#!/bin/bash
|
return `#!/bin/bash
|
||||||
|
|
||||||
# RepoHub Installation Script for Fedora
|
# RepoHub Installation Script for Fedora
|
||||||
@@ -99,7 +99,7 @@ echo "Installation completed!"`
|
|||||||
|
|
||||||
function generateArchScript(packages: SelectedPackage[]): string {
|
function generateArchScript(packages: SelectedPackage[]): string {
|
||||||
const packageNames = packages.map(p => p.name).join(' ')
|
const packageNames = packages.map(p => p.name).join(' ')
|
||||||
|
|
||||||
return `#!/bin/bash
|
return `#!/bin/bash
|
||||||
|
|
||||||
# RepoHub Installation Script for Arch Linux
|
# RepoHub Installation Script for Arch Linux
|
||||||
@@ -110,13 +110,34 @@ set -e
|
|||||||
|
|
||||||
echo "Starting package installation for Arch Linux..."
|
echo "Starting package installation for Arch Linux..."
|
||||||
|
|
||||||
|
# Check if yay is installed
|
||||||
|
if ! command -v yay &> /dev/null; then
|
||||||
|
echo "yay is not installed. Installing yay..."
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
echo "Installing dependencies..."
|
||||||
|
sudo pacman -S --needed --noconfirm git base-devel
|
||||||
|
|
||||||
|
# Clone and build yay
|
||||||
|
echo "Building yay..."
|
||||||
|
git clone https://aur.archlinux.org/yay-bin.git
|
||||||
|
cd yay-bin
|
||||||
|
makepkg -si --noconfirm
|
||||||
|
cd ..
|
||||||
|
rm -rf yay-bin
|
||||||
|
|
||||||
|
echo "yay installed successfully!"
|
||||||
|
else
|
||||||
|
echo "yay is already installed."
|
||||||
|
fi
|
||||||
|
|
||||||
# Update package lists
|
# Update package lists
|
||||||
echo "Updating package lists..."
|
echo "Updating package lists..."
|
||||||
sudo pacman -Sy --noconfirm
|
yay -Sy --noconfirm
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
echo "Installing packages: ${packageNames}"
|
echo "Installing packages: ${packageNames}"
|
||||||
sudo pacman -S --noconfirm ${packageNames}
|
yay -S --noconfirm ${packageNames}
|
||||||
|
|
||||||
# Verify installation
|
# Verify installation
|
||||||
echo "Verifying installation..."
|
echo "Verifying installation..."
|
||||||
@@ -133,7 +154,7 @@ echo "Installation completed!"`
|
|||||||
|
|
||||||
function generateWindowsScript(packages: SelectedPackage[]): string {
|
function generateWindowsScript(packages: SelectedPackage[]): string {
|
||||||
const packageNames = packages.map(p => p.name).join(' ')
|
const packageNames = packages.map(p => p.name).join(' ')
|
||||||
|
|
||||||
return `# RepoHub Installation Script for Windows
|
return `# RepoHub Installation Script for Windows
|
||||||
# Generated on ${new Date().toISOString()}
|
# Generated on ${new Date().toISOString()}
|
||||||
# This script is idempotent and safe to run multiple times
|
# This script is idempotent and safe to run multiple times
|
||||||
@@ -186,7 +207,7 @@ Write-Host 'Installation completed!'`
|
|||||||
|
|
||||||
function generateMacOSScript(packages: SelectedPackage[]): string {
|
function generateMacOSScript(packages: SelectedPackage[]): string {
|
||||||
const packageNames = packages.map(p => p.name).join(' ')
|
const packageNames = packages.map(p => p.name).join(' ')
|
||||||
|
|
||||||
return `#!/bin/bash
|
return `#!/bin/bash
|
||||||
|
|
||||||
# RepoHub Installation Script for macOS
|
# RepoHub Installation Script for macOS
|
||||||
|
|||||||
Reference in New Issue
Block a user