summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-dev/lh_setup_dev.sh
blob: f0cc94cfcd319b7ae208ee15db6de2791eb47dfa (plain)
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
#!/bin/bash

echo "Creating repo directories..."
sudo mkdir -p /data/dev/
sudo chmod a+w /data/dev/
mkdir -p /data/dev/LH_buildroot
mkdir -p /data/dev/pkg_repo/x86_64/linhes
mkdir -p /data/dev/pkg_repo/x86_64/linhes-testing
mkdir -p /data/dev/pkg_repo/packages
mkdir -p /data/dev/pkg_repo/sources
mkdir -p /data/dev/pkg_repo/src_packages/linhes
mkdir -p /data/dev/pkg_repo/src_packages/linhes-testing

echo -e "\n\nChanging setting in /etc/makepkg.conf..."
#sudo sed -i 's/#PKGDEST=.*/PKGDEST=\/data\/dev\/pkg_repo\/packages/' /etc/makepkg.conf
sudo sed -i 's/#SRCDEST=.*/SRCDEST=\/data\/dev\/pkg_repo\/sources/' /etc/makepkg.conf
sudo sed -i 's/#SRCPKGDEST=.*/SRCPKGDEST=\/data\/dev\/pkg_repo\/src_packages/' /etc/makepkg.conf
sudo sed -i 's/#PACKAGER=.*/PACKAGER=\"LinHESDev <LinHESDev\@linhes.org>\"/' /etc/makepkg.conf
sudo sed -i 's/^COMPRESSGZ=.*/COMPRESSGZ=(pigz -c -f -n)/' /etc/makepkg.conf
sudo sed -i 's/^COMPRESSXZ=.*/COMPRESSXZ=(xz -c -z --threads=0 -)/' /etc/makepkg.conf
sudo sed -i 's/^COMPRESSZST=.*/COMPRESSZST=(zstd -c -z -q --threads=0 -)/' /etc/makepkg.conf

echo -e "\n\nSetup clean-chroot-manager (ccm) and edit ~/.config/clean-chroot-manager.conf"...
sudo ccm l
sed -i 's/CHROOTPATH64=.*/CHROOTPATH64=\"\/data\/dev\/LH_buildroot\"/' ~/.config/clean-chroot-manager.conf
sed -i 's/#CUSTOM_PACMAN_CONF=.*/CUSTOM_PACMAN_CONF=\"\/usr\/share\/linhes\/templates\/pacman.conf.template\"/' ~/.config/clean-chroot-manager.conf
sed -i 's/#CUSTOM_MAKEPKG_CONF=.*/CUSTOM_MAKEPKG_CONF=\"\/etc\/makepkg.conf\"/' ~/.config/clean-chroot-manager.conf
sudo ccm c

echo -e "\n\nAdd aliases to .bashrc..."
if ! grep -q 'alias ccm=' ~/.bashrc; then
    echo -e "\nalias ccm='sudo ccm'" >> ~/.bashrc
fi
if ! grep -q 'alias cddev=' ~/.bashrc; then
    echo -e "alias cddev='cd /data/dev/'" >> ~/.bashrc
fi
if ! grep -q 'alias cdl=' ~/.bashrc; then
    echo -e "alias cdl='cd /data/dev/linhes_pkgbuild/linhes'" >> ~/.bashrc
fi
if ! grep -q 'alias cdb=' ~/.bashrc; then
    echo -e "alias cdb='cd /data/dev/linhes_pkgbuild/linhes/linhes-dev/LinHES9_iso'" >> ~/.bashrc
fi

if ! grep -q 'ssh-agent >' ~/.bashrc; then
cat >> ~/.bashrc<<END
if ! pgrep -u "\$USER" ssh-agent > /dev/null; then
    ssh-agent > "\$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! -f "\$SSH_AUTH_SOCK" ]]; then
    source "\$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi
ssh-add -q
END
fi

echo -e "\n\nAdd rclone.conf..."
if [ ! -f ~/.config/rclone/rclone.conf ]; then
    mkdir -p ~/.config/rclone && touch ~/.config/rclone/rclone.conf
fi
if ! grep -q 'host = linhes.org' ~/.config/rclone/rclone.conf; then
cat >> ~/.config/rclone/rclone.conf<<END
[ssh]
type = sftp
host = linhes.org
user = reposync
key_file = ssh-agent
pubkey_file = ~/.ssh/id_rsa.pub
END
fi

# clone the git linhes_pkgbuild
# Checkout the repo. You will need to have been given a dev account on
# linhes.org. This involves creating a public ssh key and supplying it to
# one of the linhes.org admins. The key is created using ssh-keygen. The
# resulting public key will be stored in .ssh/id_rsa.pub.
echo -e "\n\nCheckout the repo manually. You will need to be given a dev account on linhes.org. This involves creating a public ssh key and supplying it toone of the linhes.org admins. The key is created using ssh-keygen. The resulting public key will be stored in .ssh/id_rsa.pub."
echo -e "EXAMPLE: \ncd /data/dev\ngit clone git@linhes.org:linhes_pkgbuild\ngit checkout testing\n\n"