Calling rest of installers
oginstaller/pipeline/head There was a failure building this commit
Details
oginstaller/pipeline/head There was a failure building this commit
Details
parent
b2305740b2
commit
a1cf2b59dd
|
@ -142,16 +142,30 @@ do
|
||||||
ogDhcp)
|
ogDhcp)
|
||||||
echo "Instalando ogDhcp..."
|
echo "Instalando ogDhcp..."
|
||||||
git_checkout_release "$OGDHCP_REPO" "$component_dir/repo" "$OGCORE_BRANCH"
|
git_checkout_release "$OGDHCP_REPO" "$component_dir/repo" "$OGCORE_BRANCH"
|
||||||
|
cp $CONFIGS_DIR/$config_file $component_dir/repo/config_ogdhcp.json
|
||||||
|
cd $component_dir/repo/installer || exit
|
||||||
|
chmod 755 ogdhcp_installer.sh
|
||||||
|
./ogdhcp_installer.sh
|
||||||
|
cd - || exit
|
||||||
echo - ogDhcp >> /etc/issue
|
echo - ogDhcp >> /etc/issue
|
||||||
;;
|
;;
|
||||||
ogBoot)
|
ogBoot)
|
||||||
echo "Instalando ogBoot..."
|
echo "Instalando ogBoot..."
|
||||||
git_checkout_release "$OGBOOT_REPO" "$component_dir/repo" "$OGCORE_BRANCH"
|
git_checkout_release "$OGBOOT_REPO" "$component_dir/repo" "$OGCORE_BRANCH"
|
||||||
|
cp $CONFIGS_DIR/$config_file $component_dir/repo/config.json
|
||||||
|
apt install -y python3 git vim
|
||||||
|
cd $component_dir/repo/installer || exit
|
||||||
|
python3 ogboot_installer.py
|
||||||
|
cd - || exit
|
||||||
echo - ogBoot >> /etc/issue
|
echo - ogBoot >> /etc/issue
|
||||||
;;
|
;;
|
||||||
ogRepository)
|
ogRepository)
|
||||||
echo "Instalando ogRepository..."
|
echo "Instalando ogRepository..."
|
||||||
git_checkout_release "$OGREPOSITORY_REPO" "$component_dir/repo" "$OGCORE_BRANCH"
|
cp $CONFIGS_DIR/$config_file $component_dir/installer/config.json
|
||||||
|
REPO_IP=$(jq -r '.ogrepository_ip' $component_dir/installer/config.json)
|
||||||
|
OGUSER=$(jq -r '.ogrepository_samba_user' $component_dir/installer/config.json)
|
||||||
|
OGPASS=$(jq -r '.ogrepository_samba_pass' $component_dir/installer/config.json)
|
||||||
|
provision_ogrepository.sh $REPO_IP $OGUSER $OGPASS $component_dir/repo
|
||||||
echo - ogRepository >> /etc/issue
|
echo - ogRepository >> /etc/issue
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
REPO_IP=${1:-"127.0.0.1"}
|
||||||
|
OGUSER=${2:-"opengnsys"}
|
||||||
|
OGPASS=${3:-"og"}
|
||||||
|
INSTALL_DIR=/opt/opengnsys/ogrepository
|
||||||
|
DOWNLOAD_DIR=${4:-"/tmp/ogrepository"}
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
export DEBIAN_FRONTEND
|
||||||
|
export GIT_SSL_NO_VERIFY
|
||||||
|
|
||||||
|
|
||||||
|
check_root() {
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_uftp() {
|
||||||
|
apt install uftp -y
|
||||||
|
systemctl stop uftp
|
||||||
|
systemctl disable uftp
|
||||||
|
}
|
||||||
|
|
||||||
|
install_updcast () {
|
||||||
|
apt install $DOWNLOAD_DIR/packets/udpcast_20230924_amd64.deb
|
||||||
|
}
|
||||||
|
|
||||||
|
add_user_ogrepository() {
|
||||||
|
if ! id "$OGUSER" &>/dev/null; then
|
||||||
|
echo "User ogrepository does not exist, creating it"
|
||||||
|
useradd -r -s /bin/bash $OGUSER
|
||||||
|
fi
|
||||||
|
if [ ! -f /etc/sudoers.d/$OGUSER ]; then
|
||||||
|
echo "User $OGUSER does not have sudo permissions, adding it"
|
||||||
|
echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
create_directories() {
|
||||||
|
mkdir -p $INSTALL_DIR
|
||||||
|
mkdir -p $INSTALL_DIR/images $INSTALL_DIR/images_trash/ $INSTALL_DIR/bin/ $INSTALL_DIR/etc/ $INSTALL_DIR/log/ $INSTALL_DIR/api/
|
||||||
|
chown -R $OGUSER:$OGUSER $INSTALL_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
install_dependencies() {
|
||||||
|
apt update -y
|
||||||
|
apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn wakeonlan
|
||||||
|
}
|
||||||
|
|
||||||
|
install_ext_repo() {
|
||||||
|
cp $DOWNLOAD_DIR/installer/files/ctorrent.sources /etc/apt/sources.list.d/ctorrent.sources
|
||||||
|
apt update -y
|
||||||
|
}
|
||||||
|
|
||||||
|
install_external_packages() {
|
||||||
|
apt install -y bittorrent bittornado ctorrent
|
||||||
|
}
|
||||||
|
|
||||||
|
install_ogrepo-api_service() {
|
||||||
|
cp -r $DOWNLOAD_DIR/installer/files/ogrepo-api.service /etc/systemd/system/ogrepo-api.service
|
||||||
|
sed -i "s/%%OGREPOSITORY_USER%%/$OGUSER/g" /etc/systemd/system/ogrepo-api.service
|
||||||
|
systemctl enable --now ogrepo-api
|
||||||
|
}
|
||||||
|
|
||||||
|
install_files() {
|
||||||
|
cp -pr $DOWNLOAD_DIR/bin/* $INSTALL_DIR/bin/
|
||||||
|
cp -pr $DOWNLOAD_DIR/etc/* $INSTALL_DIR/etc/
|
||||||
|
cp -pr $DOWNLOAD_DIR/api/* $INSTALL_DIR/api/
|
||||||
|
chown -R $OGUSER:$OGUSER $INSTALL_DIR
|
||||||
|
chmod 755 $INSTALL_DIR/bin/*
|
||||||
|
echo IPlocal="$REPO_IP" > $INSTALL_DIR/etc/ogAdmRepo.cfg
|
||||||
|
sudo chown $OGUSER:$OGUSER $INSTALL_DIR/etc/ogAdmRepo.cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_samba() {
|
||||||
|
echo "include = /etc/samba/smb.conf.ogrepository" >> /etc/samba/smb.conf
|
||||||
|
cp $DOWNLOAD_DIR/installer/files/ogrepo-smb.conf /etc/samba/smb.conf.ogrepository
|
||||||
|
sed -i "s/%%OGREPOSITORY_USER%%/$OGUSER/g" /etc/samba/smb.conf.ogrepository
|
||||||
|
systemctl restart smbd
|
||||||
|
# Create default user ogrepository
|
||||||
|
(echo $OGPASS; echo $OGPASS) | smbpasswd -s -a $OGUSER
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
## Main program
|
||||||
|
|
||||||
|
install_dependencies
|
||||||
|
add_user_ogrepository
|
||||||
|
install_ext_repo
|
||||||
|
install_external_packages
|
||||||
|
install_uftp
|
||||||
|
install_updcast
|
||||||
|
create_directories
|
||||||
|
install_files
|
||||||
|
install_ogrepo-api_service
|
||||||
|
configure_samba
|
Loading…
Reference in New Issue