Browse Source

add script for samba install and config

master
filesite 2 years ago
parent
commit
638d21a0a1
  1. 6
      Dockerfile
  2. 27
      Dockerfile_samba
  3. 37
      bin/install.sh
  4. 18
      bin/smbpwd.sh
  5. 6
      bin/upgrade.sh
  6. 7
      conf/smb.conf
  7. 7
      docker-entrypoint.sh

6
Dockerfile

@ -10,6 +10,12 @@ RUN apk add \ @@ -10,6 +10,12 @@ RUN apk add \
&& mv machete/ /var/www/ \
&& cd /var/www/ && rm -rf downloads/ \
&& mkdir machete/www/navs/ && mkdir machete/www/girls/ && mkdir machete/www/videos/ \
&& cd machete/ \
&& chown apache:apache runtime/ \
&& chown -R apache:apache www/content/ \
&& chown apache:apache www/navs/ \
&& chown apache:apache www/girls/ \
&& chown apache:apache www/videos/ \
&& rm -f /etc/nginx/http.d/default.conf \
&& cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/http.d/machete.conf

27
Dockerfile_samba

@ -5,7 +5,7 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n @@ -5,7 +5,7 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
&& yum -y install yum-utils \
&& yum-config-manager --disable 'remi-php*' \
&& yum-config-manager --enable remi-safe \
&& yum -y install php82-php-fpm php82-php-gd php82-php-mbstring nginx wget rsync \
&& yum -y install php82-php-fpm php82-php-gd php82-php-mbstring nginx wget rsync samba \
&& ln -s /opt/remi/php82/root/usr/sbin/php-fpm /usr/sbin/php-fpm \
&& cd /etc/opt/remi/php82/ \
&& sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/g' php.ini \
@ -15,10 +15,33 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n @@ -15,10 +15,33 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
&& mv machete/ /var/www/ \
&& cd /var/www/ && rm -rf downloads/ \
&& mkdir machete/www/navs/ && mkdir machete/www/girls/ && mkdir machete/www/videos/ \
&& cd machete/ \
&& chown apache:apache runtime/ \
&& chown -R apache:apache www/content/ \
&& chown apache:apache www/navs/ \
&& chown apache:apache www/girls/ \
&& chown apache:apache www/videos/ \
&& rm -f /etc/nginx/nginx.conf \
&& cp /var/www/machete/conf/nginx.conf /etc/nginx/nginx.conf \
&& cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/conf.d/machete.conf \
&& ln -s /var/www/machete/bin/upgrade.sh /usr/bin/upgrade_machete
&& ln -s /var/www/machete/bin/upgrade.sh /usr/bin/upgrade_machete \
&& mkdir -p /var/www/sambashare/filesite/ \
&& cd /var/www/sambashare/filesite/ \
&& mv /var/www/machete/www/content/ ./ \
&& mv /var/www/machete/www/navs/ ./ \
&& mv /var/www/machete/www/girls/ ./ \
&& mv /var/www/machete/www/videos/ ./ \
&& ln -s /var/www/sambashare/filesite/content/ /var/www/machete/www/content \
&& ln -s /var/www/sambashare/filesite/navs/ /var/www/machete/www/navs \
&& ln -s /var/www/sambashare/filesite/girls/ /var/www/machete/www/girls \
&& ln -s /var/www/sambashare/filesite/videos/ /var/www/machete/www/videos \
&& chgrp apache /var/www/sambashare/ \
&& useradd -M -d /var/www/sambashare/filesite -s /usr/sbin/nologin -G apache filesite \
&& chown -R filesite:apache /var/www/sambashare/filesite \
&& chmod -R 770 /var/www/sambashare/filesite \
&& rm -f /etc/samba/smb.conf && cp /var/www/machete/conf/smb.conf /etc/samba/ \
&& /var/www/machete/bin/smbpwd.sh filesite 88888888 \
&& ln -s /var/www/machete/bin/smbpwd.sh /usr/bin/smbpwd
EXPOSE 80/tcp
ENTRYPOINT ["/var/www/machete/docker-entrypoint.sh"]

37
bin/install.sh

@ -9,6 +9,7 @@ yum-config-manager --enable remi-safe @@ -9,6 +9,7 @@ yum-config-manager --enable remi-safe
yum -y install php82-php-fpm php82-php-gd php82-php-mbstring
yum -y install nginx
yum -y install wget
yum -y install samba
ln -s /opt/remi/php82/root/usr/sbin/php-fpm /usr/sbin/php-fpm
php-fpm -v
@ -31,6 +32,42 @@ sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/g' php.ini @@ -31,6 +32,42 @@ sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/g' php.ini
#/usr/sbin/nginx
## samba user and directory config
#mkdir -p /var/www/sambashare/filesite/
#cd /var/www/sambashare/filesite/
#mv /var/www/machete/www/content/ ./
#mv /var/www/machete/www/navs/ ./
#mv /var/www/machete/www/girls/ ./
#mv /var/www/machete/www/videos/ ./
#ln -s /var/www/sambashare/filesite/content/ /var/www/machete/www/content
#ln -s /var/www/sambashare/filesite/navs/ /var/www/machete/www/navs
#ln -s /var/www/sambashare/filesite/girls/ /var/www/machete/www/girls
#ln -s /var/www/sambashare/filesite/videos/ /var/www/machete/www/videos
#chgrp apache /var/www/sambashare/
#useradd -M -d /var/www/sambashare/filesite -s /usr/sbin/nologin -G apache filesite
#chown -R filesite:apache /var/www/sambashare/filesite
#chmod -R 770 /var/www/sambashare/filesite
#smbpasswd -a filesite
#smbpasswd -e filesite
## start samba
#/usr/sbin/smbd -D
## open port for http and https
#firewall-cmd –-permanent –-add-service=http
#firewall-cmd –-permanent –-add-service=https
## open port for samba
#firewall-cmd –-permanent –-add-service=samba
#firewall-cmd –-reload
## php82-fpm's path
##/etc/logrotate.d/php82-php-fpm
##/etc/opt/remi/php82/php-fpm.conf

18
bin/smbpwd.sh

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
#!/bin/sh
username=$1
password=$2
if [ -z $username ]; then
user='filesite'
fi
if [ -z $password ]; then
user='88888888'
fi
#sleep 3
smbpasswd -a $username<<EOF
$password
$password
EOF

6
bin/upgrade.sh

@ -14,6 +14,12 @@ rsync -vruL machete/* /var/www/machete/ \ @@ -14,6 +14,12 @@ rsync -vruL machete/* /var/www/machete/ \
--exclude=www/girls/ \
--exclude=www/videos/ \
--exclude=runtime/
cd /var/www/machete/ \
&& chown apache:apache runtime/ \
&& chown -R apache:apache www/content/ \
&& chown apache:apache www/navs/ \
&& chown apache:apache www/girls/ \
&& chown apache:apache www/videos/
echo "Machete upgrade done."
echo ""

7
conf/smb.conf

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
[machete]
path = /var/www/sambashare/filesite
browseable = yes
read only = no
force create mode = 0660
force directory mode = 0777
valid users = filesite @sambashare

7
docker-entrypoint.sh

@ -9,8 +9,13 @@ echo "Theme chosed [${theme}]." @@ -9,8 +9,13 @@ echo "Theme chosed [${theme}]."
## 复制对应皮肤的配置文件
cd /var/www/machete/runtime/
rm -f custom_config.json
cp "../conf/custom_config_${theme}.json" ./
cp "../conf/custom_config_${theme}.json" ./custom_config.json
## 启动samba
if [ -e /usr/sbin/smbd ]; then
echo "Start smbd."
/usr/sbin/smbd -D
fi
## 启动nginx和php-fpm
if [ -e /usr/sbin/nginx ]; then

Loading…
Cancel
Save