Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-22022-2210132
proj356 Dev-Env-Deploy -1823
Commits
c1669684
Commit
c1669684
authored
1 year ago
by
brucekomike
Browse files
Options
Download
Patches
Plain Diff
generual fix for arch scripts
parent
8e43a93d
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
deploy-scripts/local/bin/arch-deploy-aur.sh
+58
-0
deploy-scripts/local/bin/arch-deploy-aur.sh
deploy-scripts/local/bin/arch-deploy.sh
+42
-74
deploy-scripts/local/bin/arch-deploy.sh
deploy-scripts/local/bin/env-check-linux.sh
+65
-13
deploy-scripts/local/bin/env-check-linux.sh
deploy-scripts/local/deploy-menu.sh
+19
-0
deploy-scripts/local/deploy-menu.sh
with
184 additions
and
87 deletions
+184
-87
deploy-scripts/local/bin/arch-deploy-aur.sh
0 → 100755
+
58
−
0
View file @
c1669684
#!/bin/bash
source
./bin/env-check-linux.sh
env-check
'Arch Linux'
yay_install
=
"yay -Sy --needed "
function
install-yay
(){
cd
/opt
git clone https://aur.archlinux.org/yay.git
cd
yay
makepkg
-si
cd
$SCRIPT_DIR
}
function
check-yay
(){
echo
"Checking yay"
if
[[
yay
--version
&> /dev/null]]
then
install-yay
fi
}
function
install_aur_packages
(){
checking-nonroot
check-yay
###################
#this part for aur (or other)packages
###################
# Use dialog to generate a checklist
BROWSER_PACKAGES
=
"google-chrome-beta "
IDE_PACKAGE
=
"visual-studio-code-bin android-studio"
REMOTE_PACKAGES
=
"rustdesk netbird netbird-ui "
SELECTED_PACKAGES
=
$(
dialog
--checklist
"Select other packages to install:"
20 60 10
\
"DOCUMENT_PACKAGES"
"Document Packages"
on
\
"LATEX_PACKAGES"
"Latex Packages"
on
\
"GRAPHIC_PACKAGES"
"Graphic Packages"
on
\
"MEDIA_PACKAGES"
"Media Packages"
on
\
"BROWSER_PACKAGES"
"Browser Packages"
on
\
"IDE_PACKAGE"
"Various GUI IDE "
on
\
"REMOTE_PACKAGES"
"Remote Packages"
on
\
"ADB_PACKAGES"
"ADB Packages"
on
\
3>&1 1>&2 2>&3 3>&-
)
for
package
in
$SELECTED_PACKAGES
do
echo
$package
eval
"YAY_PACKAGES+=
\"
${
!package
}
\"
"
done
# Install the selected packages
if
[[
-n
"
$YAY_PACKAGES
"
]]
;
then
$yay_install
$YAY_PACKAGES
else
echo
"No packages selected"
fi
}
This diff is collapsed.
Click to expand it.
deploy-scripts/local/bin/arch-deploy.sh
+
42
−
74
View file @
c1669684
...
...
@@ -8,128 +8,96 @@
## @author brucekomike
##
source
env-check-linux.sh
env-check
'Arch Linux'
source
./bin/
env-check-linux.sh
env-check
-root
'Arch Linux'
pacman_install
=
"pacman -Sy --needed --noconfirm "
yay_install
=
"yay -Sy --needed noconfirm "
function
install_yay
(){
cd
/opt
git clone https://aur.archlinux.org/yay.git
cd
yay
makepkg
-si
cd
$SCRIPT_DIR
}
function
check_yay
(){
echo
"Checking yay"
if
!
yay
-v
&> /dev/null
then
install_yay
fi
}
function
install_packages
(){
function
install_pacman_packages
(){
PACMAN_PACKAGES
=
""
YAY_PACKAGES
=
""
BASIC_PACKAGES
=
"base linux linux-firmware nano vi usbutils dnsutils nmap arp-scan openssh "
BASIC_PACKAGES
=
"base linux linux-firmware nano vi usbutils dnsutils nmap arp-scan openssh
sudo
"
BL_PACKAGES
=
"grub efibootmgr "
PLASMA_DE_PACKAGES
=
"xorg xorg-xinit plasma kde-applications kup bup rsync "
FCITX_IM_PACKAGES
=
"fcitx5-im fcitx5-chinese-addons fcitx5-mozc adobe-source-han-sans-cn-fonts adobe-source-han-sans-jp-fonts "
PRINTER_PACKAGES
=
"cups cups-pdf print-manager system-config-printer "
BASE_DEV_PACKAGES
=
"base-devel go fakeroot linux-headers "
BASE_DEV_PACKAGES
=
"base-devel go fakeroot linux-headers "
ADB_PACKAGES
=
"scrcpy android-tools "
BROWSER_PACKAGES
=
"firefox chromium "
LATEX_PACKAGES
=
"textlive kile kbibtex "
GRAPHIC_PACKAGES
=
"krita gimp inkscape "
MEDIA_PACKAGES
=
"vlc audacity kdenlive "
OFFICE_PACKAGES
=
"libreoffice calligra "
DOCUMENT_PACKAGES
=
"zettlr obsidian xournalpp "
###################
#this part for pacman packages
###################
# Use dialog to generate a checklist
SELECTED_PACKAGES
=
$(
dialog
--checklist
"Select pacman packages to install:"
2
0
6
0 10
\
SELECTED_PACKAGES
=
$(
dialog
--checklist
"Select pacman packages to install:"
0 0 10
\
"BASIC_PACKAGES"
"Basic Packages"
on
\
"BL_PACKAGES"
"Bootloader Packages"
on
\
"PLASMA_DE_PACKAGES"
"Plasma Desktop Packages"
on
\
"FCITX_IM_PACKAGES"
"Fcitx Input Method Packages"
on
\
"PRINTER_PACKAGES"
"Printer Packages"
on
\
"BASE_DEV_PACKAGES"
"Base Development Packages"
on
\
3>&1 1>&2 2>&3 3>&-
)
# Convert selected package names to their values
for
package
in
$SELECTED_PACKAGES
do
echo
$package
eval
"PACMAN_PACKAGES+=
\"
${
!package
}
\"
"
done
# Install the selected packages
if
[
-n
"
$PACMAN_PACKAGES
"
]
;
then
echo
$pacman_install
$PACMAN_PACKAGES
else
echo
"No packages selected"
fi
###################
#this part for aur (or other)packages
###################
# Use dialog to generate a checklist
DOCUMENT_PACKAGES
=
"libreoffice calligra zettlr obsidian "
LATEX_PACKAGES
=
"textlive kile kbibtex "
GRAPHIC_PACKAGES
=
"krita gimp inkscape "
MEDIA_PACKAGES
=
"vlc audacity kdenlive "
BROWSER_PACKAGES
=
"firefox chromium "
IDE_PACKAGE
=
"visual-studio-code-bin android-studio"
REMOTE_PACKAGES
=
"rustdesk netbird netbird-ui "
ADB_PACKAGES
=
"scrcpy android-tools "
SELECTED_PACKAGES
=
$(
dialog
--checklist
"Select other packages to install:"
20 60 10
\
"DOCUMENT_PACKAGES"
"Document Packages"
on
\
"ADB_PACKAGES"
"ADB Packages"
on
\
"BROWSER_PACKAGES"
"Browser Packages"
on
\
"LATEX_PACKAGES"
"Latex Packages"
on
\
"GRAPHIC_PACKAGES"
"Graphic Packages"
on
\
"MEDIA_PACKAGES"
"Media Packages"
on
\
"BROWSER_PACKAGES"
"Browser Packages"
on
\
"IDE_PACKAGE"
"Various GUI IDE "
on
\
"REMOTE_PACKAGES"
"Remote Packages"
on
\
"ADB_PACKAGES"
"ADB Packages"
on
\
"DOCUMENT_PACKAGES"
"Document Packages"
on
\
3>&1 1>&2 2>&3 3>&-
)
# Convert selected package names to their values
for
package
in
$SELECTED_PACKAGES
do
echo
$package
eval
"
YAY
_PACKAGES+=
\"
${
!package
}
\"
"
eval
"
PACMAN
_PACKAGES+=
\"
${
!package
}
\"
"
done
# Install the selected packages
if
[
-n
"
$YAY_PACKAGES
"
]
;
then
check_yay
echo
$yay_install
$YAY_PACKAGES
if
[[
-n
"
$PACMAN_PACKAGES
"
]]
;
then
$pacman_install
$PACMAN_PACKAGES
else
echo
"No packages selected"
fi
echo
since yay can not be run as root
echo
you should run arch-deploy-aur.sh to
install
aur packages
}
function
setup_shell_prompt
(){
USERNAME
=
$(
get-user-input
"Enter the username to install shell prompt"
)
CUSTOM_PS1
=
$(
cat
$SCRIPT_DIR
/share/bash-ps1-temp
)
CUSTOM_PROMPT
=
"
\$
CUSTOM_PROMPT=
$(
get_user_input
"Enter your custom prompt"
)
"
echo
$CUSTOM_PS1
>>
~/.bashrc
echo
$CUSTOM_PROMPT
>>
~/.bashrc
CUSTOM_PROMPT
=
"export CUSTOM_NOTATON=
$(
get-user-input
"Enter your custom prompt"
)
"
echo
$CUSTOM_PROMPT
>>
/home/
$USERNAME
/.bashrc
echo
$CUSTOM_PS1
>>
/home/
$USERNAME
/.bashrc
}
function
installing_aur_packages
(){
check-package
sudo
$pacman_install
SUDO_USER
=
$(
get-user-input
"Enter the user to run yay"
)
sudo
-u
$SUDO_USER
$SCRIPT_DIR
/bin/arch-deploy-aur.sh
}
function
main
(){
SELECTED_OPERATION
=
dialog
--checklist
"Select operation to perform:"
20 60 10
\
"install_packages"
"Install Packages"
on
\
SELECTED_OPERATION
=
$(
dialog
--checklist
"Select operation to perform:"
20 60 10
\
"install_pacman_packages"
"Install Packages"
on
\
"install_aur_packages"
"Install AUR Packages"
on
\
"setup_shell_prompt"
"Setup Shell Prompt"
on
\
3>&1 1>&2 2>&3 3>&-
3>&1 1>&2 2>&3 3>&-
)
if
[
-z
"
$SELECTED_OPERATION
"
]
;
then
echo
"No operation selected"
exit
1
fi
else
for
operation
in
$SELECTED_OPERATION
do
eval
"
$operation
"
done
fi
}
check-package
'dialog'
$pacman_install
check-package
'git'
$pacman_install
check_yay
package-check
'dialog'
$pacman_install
package-check
'git'
$pacman_install
main
\ No newline at end of file
This diff is collapsed.
Click to expand it.
deploy-scripts/local/bin/env-check-linux.sh
+
65
−
13
View file @
c1669684
#!/bin/bash
export
SCRIPT_DIR
=
"
$(
pwd
)
"
function
env-check
(){
echo
checking envrionment
# $1 is the os name
echo
export
PASSED
=
1
function
check-root
(){
if
[[
"
$EUID
"
-ne
0
]]
then
echo
"This script must be executed with root permission"
export
PASSED
=
0
PASSWD
=
0
else
echo
"Root permission granted"
fi
}
function
check-nonroot
(){
if
[[
"
$EUID
"
-ne
0
]]
then
echo
"non-root check passed"
else
echo
"This script must run as non-root"
PASSWD
=
0
fi
}
function
check-os
(){
# $1 is the os name
if
!
grep
-q
"
$1
"
/etc/os-release
then
echo
"This script should be run in
$1
"
export
PASSED
=
0
PASSWD
=
0
else
echo
"OS is
$1
"
fi
if
[[
-z
${
SCRIPT_DIR
:+x
}
]]
}
function
check-script-dir
(){
if
!
[[
-n
"
$SCRIPT_DIR
"
]]
then
echo
"No
\$
SCRIPT_DIR presentlsed"
export
PASSED
=
0
echo
"No
\$
SCRIPT_DIR present"
PASSWD
=
0
else
echo
"SCRIPT_DIR is
$SCRIPT_DIR
"
fi
}
function
report-fail
(){
if
[[
"
$PASSED
"
-eq
0
]]
;
then
echo
...
...
@@ -28,8 +45,40 @@ function env-check(){
exit
1
fi
}
function
env-check
(){
export
PASSED
=
1
check-os
"
$1
"
check-script-dir
report-fail
}
function
env-check-root
(){
export
PASSED
=
1
check-root
check-os
"
$1
"
check-script-dir
report-fail
}
function
env-check-nonroot
(){
export
PASSED
=
1
check-nonroot
check-os
"
$1
"
check-script-dir
report-fail
}
function
checking-nonroot
(){
export
PASSED
=
1
check-nonroot
report-fail
}
function
checking-root
(){
export
PASSED
=
1
check-root
report-fail
}
function
package
-check
(){
function
check-
package
(){
# $1 is the package name
# $2 is the command to install that package
if
!
$1
-h
&>/dev/null
...
...
@@ -37,9 +86,12 @@ function package-check(){
fi
}
get
_
user
_
input
()
{
get
-
user
-
input
()
{
# $1 is the inputbox name
local
result
=
$(
dialog
--inputbox
"
$1
"
0 0 3>&1 1>&2 2>&3 3>&-
)
echo
"
$result
"
}
function
check-proxy
(){
:
}
This diff is collapsed.
Click to expand it.
deploy-scripts/local/deploy-menu.sh
0 → 100755
+
19
−
0
View file @
c1669684
#!/bin/bash
export
SCRIPT_DIR
=
"
$(
pwd
)
"
source
./bin/env-check-linux.sh
checking-root
# detect the os
if
[[
-f
/etc/os-release
]]
;
then
.
/etc/os-release
OS
=
$NAME
elif
type
lsb_release
>
/dev/null 2>&1
;
then
OS
=
$(
lsb_release
-si
)
else
OS
=
$(
uname
-s
)
fi
if
[[
"
$OS
"
==
"Ubuntu"
]]
;
then
source
./bin/ubuntu-deploy.sh
elif
[[
"
$OS
"
==
"Arch Linux"
]]
;
then
source
./bin/arch-deploy.sh
fi
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets