-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaur_setup.sh
More file actions
63 lines (58 loc) · 1.43 KB
/
aur_setup.sh
File metadata and controls
63 lines (58 loc) · 1.43 KB
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
#!/bin/bash
dir_home=/home/alarm
dir_git=$dir_home/.config/git
dir_ssh=$dir_home/.ssh
if [[ -e $dir_ssh/aur ]]; then
#........................
dialog $opt_yesno '
AUR Git has already setup.
\Z1Continue?\Z0
' 0 0 || exit
#----------------------------------------------------------------------------
fi
echo "
Host aur.archlinux.org
IdentityFile ~/.ssh/aur
User aur
" >> /etc/ssh/ssh_config
systemctl restart sshd
[[ -e /usr/bin/git ]] || pacman -Sy --noconfirm git
#........................
key=$( dialogMenu 'Raspberry Pi' "\
Use existing keys
Generate new keys" )
if [[ $key == 1 ]]; then
#........................
dialog $opt_msg '
Copy saved \Z1.ssh/{aur,aur.pub}\Z0 > $dir_home
Then \Zr OK \ZR to continue.
' 7 58
else
mkdir -p $dir_ssh
ssh-keygen -t rsa -f $dir_ssh/aur -q -N ""
sed -i 's/= .*$/=/' $dir_ssh/aur.pub # remove trailing USER@HOSTNAME
#........................
dialog $opt_msg "
AUR > My Account
\Z1SSH Public Key:\Z0
$( cat $dir_ssh/aur.pub )
\Z1PGP Key Fingerprint:\Z0 (empty)
\Z1Your current password:\Z0 (password)
" 24 58
fi
#........................
email=$( dialog.input '\Z1Email:\Z0' [email protected] )
#........................
username=$( dialog.input '\Z1Username:\Z0' rern )
echo "\
[user]
email = $email
name = $username
" > $dir_home/.gitconfig
mkdir -p $dir_git
touch $dir_git/{attributes,ignore}
chown -R alarm:alarm $dir_home
chmod 700 $dir_ssh
chmod 600 $dir_ssh/*
sudo -u alarm git init $dir_home
bar Done