Merge branch 'master' of ssh://git.barkshark.tk:2222/izaliamae/scripts

This commit is contained in:
Gitea 2019-02-21 19:12:44 -05:00
commit aea9d2d9d2
3 changed files with 115 additions and 2 deletions

View file

@ -1,19 +1,24 @@
#!/bin/sh
HDPART=/dev/sdb2
ROOT=/dev/sdb2
FS=ext4
CHDIR=/mnt/root
# Mount the root partition
sudo mount $HDPART -t $FS $CHDIR -o noatime,nodiratime
sudo mount $ROOT -t $FS $CHDIR -o noatime,nodiratime
# Various needed pseudo fs dirs
sudo mount --bind /dev $CHDIR/dev
sudo mount --bind /proc $CHDIR/proc
sudo mount --bind /sys $CHDIR/sys
sudo mount --bind /dev/pts $CHDIR/dev/pts
# Uncomment to include /home
#sudo mount --bind /home $CHDIR/home
# Extra mounts
#sudo mount --bind /mnt/data $CHDIR/mnt/data
sudo chroot $CHDIR
sudo umount -R $CHDIR

11
debloat.sh Normal file
View file

@ -0,0 +1,11 @@
#!/bin/bash
list="~/.config/debloat-pkgs.txt"
declare -a packages
readarray packages < $list
for pkg in ${packages[*]}
do
adb shell pm uninstall --user 0 $pkg
done

97
setupmasto.sh Executable file
View file

@ -0,0 +1,97 @@
#!/usr/bin/env bash
###
# setupmasto.sh v0.1
#
# This script will do everything necessary to download and install a dev Mastodon instance.
# No user interaction required :3
#
# Currently only tested on Debian Stretch and Ubuntu Cosmic
###
#MASTO_REPO=https://github.com/tootsuite/mastodon
MASTO_REPO=https://github.com/glitch-soc/mastodon
MASTO_PATH=$HOME/mastodon-dev
# get os info for proper dep installation
. /etc/os-release
function installDebDeps {
# install curl
sudo apt install curl gnupg --no-install-recommends -y
# setup node repo if not running ubuntu
if [ $NAME == "Ubuntu" ]
then
echo "Skipping node repos since it's uneccessary on this OS"
else
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
fi
# setup yarn repo
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# update repos
sudo apt update
# install needed libraries & programs for ruby & mastodon
sudo apt install --no-install-recommends -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core \
g++ libprotobuf-dev protobuf-compiler pkg-config nodejs gcc autoconf libjemalloc-dev \
bison build-essential libssl-dev libyaml-dev libreadline-dev \
zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \
redis-server redis-tools postgresql postgresql-contrib \
yarn libidn11-dev libicu-dev libjemalloc-dev
}
function installRuby {
# setup rbenv
git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv
cd $HOME/.rbenv && src/configure && make -C src
# add rubyenv to bashrc
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bashrc
echo 'eval "$(rbenv init -)"' >> $HOME/.bashrc
# apply env
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# install ruby-build
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# build and install ruby with jemalloc
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.6.0
rbenv global 2.6.0
}
function installMastodon {
# create database user
echo "CREATE USER $(whoami) CREATEDB;" | sudo -u postgres psql
# clone glitch-soc
git clone $MASTO_REPO $MASTO_PATH
cd $MASTO_PATH
# update gem
printf 'y\n' | gem update --system --no-document
# install ruby and nodejs deps
gem install bundler
bundle install -j$(getconf _NPROCESSORS_ONLN)
yarn install --pure-lockfile
gem install foreman
# setup db
bundle exec rails db:setup
}
installDebDeps
installRuby
installMastodon
# Done!
echo "Setup done! Run 'foreman start' to start sidekiq, streaming, web, and webpack
Username: admin@localhost:3000
Password: mastodonadmin"