-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.sh
113 lines (89 loc) · 1.46 KB
/
cli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
set -e
source ./cli/bash/cli_source.sh
vm_help () {
cat << EOF
Available Commands:
create
ssh
detach_boot
destroy
EOF
}
vm_commands () {
case $1 in
"--help" | "-h")
vm_help
;;
"create")
setup_vm
;;
"ssh")
rm --force /home/andrew/.ssh/known_hosts
scp -r \
-P 2222 \
./andrew_arch_iso/airootfs/root/installers/* \
root@127.0.0.1:/root/installers
ssh -p 2222 root@127.0.0.1
;;
"detach_boot")
detach_usb_from_vm
;;
"destroy")
rm `pwd`/archvm/archvm_DISK.vdi
VBoxManage shutdown archvm
VBoxManage unregistervm archvm --delete
;;
*)
echo "Command '$2' not recognized."
vm_help
;;
esac
}
main_help () {
cat << EOF
Available Commands:
vm
build_iso
stow
unstow
install
build_package
EOF
}
main_commands () {
case $1 in
"--help" | "-h")
main_help
;;
"vm")
vm_commands "${@:2}"
;;
"build_iso")
mkarchiso -v -w /tmp/archiso-tmp/ ./archlivve/
;;
"build_package")
(cd ajos_package && makepkg)
mkdir -p ~/aj-os-arch-repo/
(cd ajos_package && mv *.pkg.tar.zst ~/aj-os-arch-repo/)
(cd ~/aj-os-arch-repo && repo-add aj-os.db.tar.gz *.pkg.tar.zst)
gsutil rsync \
~/aj-os-arch-repo \
gs://arch_repo_afdamda
;;
"stow")
stow_config_files
;;
"unstow")
unstow_config_files
;;
"install")
install_packages
;;
*)
echo "Command '$1' not recognized"
main_help
;;
esac
}
main_commands "$@"